repl.it
@Rayanfer32/

telethon

Python

No description

fork
loading
Files
  • main.py
  • anon.session
  • anon.session-journal
  • requirements.py
  • session_name.session
  • session_name.session-journal
  • Packager files
  • poetry.lock
  • pyproject.toml
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from telethon import TelegramClient
import os
# Use your own values from my.telegram.org
api_id = os.getenv("api_id")
api_hash = os.getenv("api_hash")
bot_token = '802451454:AAHBXzDXaZD9tLKnptRT03FPvBzmSOjDc4I'
################################################
channel_username = 'stolenapps'
################################################

client = TelegramClient('session_name',
                    api_id,
                    api_hash)

assert client.connect()
if not client.is_user_authorized():
    client.send_code_request(bot_token)
    me = client.sign_in(bot_token)

# ---------------------------------------
msgs = client.get_messages(channel_username, limit=100)
for msg in msgs.data:
    if msg.media is not None:
        client.download_media(message=msg)