[Python] How to Send Files Larger than 2GB Using Telethon in Telegram

Discussão em 'Python' iniciado por Stack, Março 10, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using Telethon to send files on Telegram, but I've run into a problem with the 2GB file size limit. Telethon only allows sending files up to 2GB, while Telegram itself supports sending files up to 4GB through the official app.

    Is there a way to bypass this 2GB limit using Telethon? I’ve tried client.send_file(), but it throws an error when the file exceeds 2GB.

    Are there any workarounds? without splitting files or downloading and then re-uploading files.

    I attempted to send a 2GB+ file using client.send_file() like this:

    from telethon import TelegramClient

    api_id = 123456
    api_hash = 'api_hash'
    session_string = 'session_string'

    client = TelegramClient(session_string, api_id, api_hash)

    async def send_large_file():
    await client.send_file('me', 'large_video.mp4')

    with client:
    client.loop.run_until_complete(send_large_file())

    Continue reading...

Compartilhe esta Página