Skip to content

Instantly share code, notes, and snippets.

@ohld
Created August 16, 2023 13:08
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohld/9ab13034c1796ca79db19c50eab47684 to your computer and use it in GitHub Desktop.
Save ohld/9ab13034c1796ca79db19c50eab47684 to your computer and use it in GitHub Desktop.
Watch million telegram stories for free with python and telethon
"""
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