python-3.xtelegram-botpy-telegram-bot-api

how i can download file more than 20 mb from bot using python?


Ok, I know in telegram bot API we can get the file_id and send it to getFile method and it will give us the file path so we can download it with an URL.

BUT it has a maximum limit of the file size of 20MB for each file.

Here is my question:

How can this bot bypass the size limitation?

Personally wouldn't believe that until tested it with a 200MB sized file and it worked very fast. I want to make one like that.

how possible i can do same i use telethon and i get api_id and api_hash any advice please it will be apricated


Solution

  • You can't do this via public Bot API in due to their limitations: https://core.telegram.org/bots/api#getfile, https://core.telegram.org/bots/api#sending-files

    But you can do this via local Bot API Server: https://core.telegram.org/bots/api#using-a-local-bot-api-server Or just use Client API directly for working with files. local Bot API Server has the same limitations as Client API.

    Local server: Can be compiled from official repository or used via third-party Docker images https://hub.docker.com/r/aiogram/telegram-bot-api And --local mode is required (TELEGRAM_LOCAL=1 env. var if you use my Docker image)

    Client API: aiogram can be used at the same time with one of Client API library like Pyrogram, Telethon or tdlib for working with files.