Relative Content

Tag Archive for pythontelegramtelethon

Stream Telethon media download to upload POST endpoint

I am trying to write a script in Python that downloads some media file from a channel and then uploads it to another location using a POST endpoint.

I am using the Telethon library to download said media file from Telegram. The issue I currently have is that, the file size is about 1Gb in size, and I’d like to stream the download directly to the upload instead of storing it in memory or in file. As far as I am aware, Telethon only allows you to download into memory or into a file.
This is the code I’m currently working with.

how do I read messages in open groups? telethon

from telethon.sync import TelegramClient api_id = ‘?????’ api_hash = ‘????????’ with TelegramClient(‘sync’, api_id, api_hash) as client: chat_entity = client.get_entity(‘https://t.me/new_ton_news’) for message in client.iter_messages(chat_entity): print(message.sender_id, ‘:’, message.text) telethon.errors.rpcerrorlist.BotMethodInvalidError: The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot (caused by GetHistoryRequest) python telegram telethon New contributor […]