Search code examples
pythontelegrampyrogram

how to download video thumbnail from telegram using pyrogram bot?


I want to download thumbnail of a video from telegram using pyrogram. Previously, I was able to download it by using telethon but now telegram has support of files greater than 2gb , and currently telethon doesn't support files greater than 2gb that is why I can't download thumbnails of file greater than 2gb with telethon, so I am trying to download thumbnails with pyrogram but unable to figure it out , so is there anyone that can help me.


Solution

  • Here is The Code which worked for me

    async def thumbnail_download(bot, message):
        # Get the Thumbnail Dict
        thumbs=message.video.thumbs[0]
        
        # Get the file_id
        file_id=thumbs.file_id
        
        # Download the Thumbnail
        location=await bot.download_media(file_id)
    
        # Thumbnail location
        print(location)