Bulk download from Telegram
UPD: Made the example work by using telethon.sync import instead of just telethon.
One day I got a lot of cool photos in Telegram chat. And I asked myself: how can I download them all at once? Because MacOS client for Telegram doesn’t have such feature (there is a feature request on Github). After some searching I found out that this can be done with help of one nice library which is named Telethon. There are more of them but I decided to write my script for bulk downloading in python.
But before some preparations are required:
- Goto https://my.telegram.org and generate api id and api hash
- Install Telethon library with
pip3 install telethon - Run following code (replace
api_id,api_hashandusernamewith your values):
| |
The code above downloads media from the last 25 messages from the chat with username in current directory.