Skip to content

Instantly share code, notes, and snippets.

@lgg lgg/
Last active Jan 23, 2019

What would you like to do?
Telegram save all media from chat/user/channel

Quick tip. It is possible to download media with small python script.

Goto and generate api id and api hash Install Telethon library with pip3 install telethon Run (replace api_id, api_hash and username with your values).

If you need proxy install pip install PySocks

This code downloads all media from the dialog with username user/chat/channel in current directory.

LICENSE: Based on: and

#uncomment line below if you need proxy
#import socks
from telethon import TelegramClient, sync
#import logging
client = TelegramClient('test_session123123123',
api_id, api_hash,
# You may want to use proxy to connect to Telegram
for message in client.iter_messages('CHATNAME/CHANNELNAME/USERNAME'):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.