Skip to content

Instantly share code, notes, and snippets.

@lgg
Last active November 23, 2025 12:09
Show Gist options
  • Select an option

  • Save lgg/3f0dc041b931222eedfae28e5cdff0fd to your computer and use it in GitHub Desktop.

Select an option

Save lgg/3f0dc041b931222eedfae28e5cdff0fd to your computer and use it in GitHub Desktop.
Telegram save all media from chat/user/channel

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

Goto https://my.telegram.org and generate api id and api hash Install Telethon library with pip3 install telethon Run saveAllMedia.py (replace api_id, api_hash and username with your values).

If you need proxy install https://github.com/Anorov/PySocks pip install PySocks

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

LICENSE: Based on: telegramdesktop/tdesktop#1382 (comment) and https://github.com/LonamiWebs/Telethon

#uncomment line below if you need proxy
#import socks
from telethon import TelegramClient, sync
#import logging
api_id=400000
api_hash='supersecreethash'
#logging.basicConfig(level=logging.DEBUG)
client = TelegramClient('test_session123123123',
api_id, api_hash,
# You may want to use proxy to connect to Telegram
#proxy=(socks.SOCKS5, 'PROXYHOST', PORT, 'PROXYUSERNAME', 'PROXYPASSWORD')
)
client.start()
for message in client.iter_messages('CHATNAME/CHANNELNAME/USERNAME'):
client.download_media(message)
@tas88-sys
Copy link
Copy Markdown

How can I download from my Saved Messages chat?

@IntenseParijat
Copy link
Copy Markdown

@tssa88
use your own username / id to download from your own saved messages

@Drazie
Copy link
Copy Markdown

Drazie commented Nov 23, 2025

Still works. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment