Created
August 16, 2023 13:08
-
-
Save ohld/9ab13034c1796ca79db19c50eab47684 to your computer and use it in GitHub Desktop.
Watch million telegram stories for free with python and telethon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
t.me/danokhlopkov | |
x.com/danokhlopkov | |
github.com/danokhlopkov | |
Strategy: | |
1. get chats / groups you're in | |
2. iterate over participants and find ones with stories | |
3. watch them | |
""" | |
from telethon import TelegramClient | |
from telethon import types, functions | |
api_id, api_hash = "", "" # get yours on my.telegram.org | |
client = TelegramClient("google_danokhlopkov", api_id, api_hash) | |
async for dialog in client.iter_dialogs(limit=500): | |
if dialog.is_group: | |
async for user in client.iter_participants(entity=dialog.entity, limit=1000): | |
if ( | |
not user.stories_unavailable and | |
not user.stories_hidden and | |
user.stories_max_id | |
): | |
res = await client( | |
functions.stories.ReadStoriesRequest( | |
user_id=user.id, | |
max_id=user.stories_max_id | |
) | |
) | |
""" | |
Next steps: | |
1. time.sleep(random.random() * m + n) | |
2. add logging to have an illusion of control | |
3. save users' and chats' matadata in db for future projects | |
4. get banned for the Telegram ToS violation. It was your fault | |
See you 👋 | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment