LonamiWebs / Telethon

Pure Python 3 MTProto API Telegram client library, for bots too!
https://docs.telethon.dev
MIT License
10.02k stars 1.41k forks source link

Is there a way to search all public posts in telegram, event channels you're not in? #4446

Closed theluxury closed 2 months ago

theluxury commented 2 months ago

Describe your suggested feature

I'm trying to do a public posts search through all channels (including ones you're not in) in telegram programmatically. I know this can be done through the desktop client: see screenshot.

I've tried using telethon, specifically, the SearchGlobalRequest method and client.iter_messages setting entity as None. However, this only searches through channels that you're a member of.

I've searched stackoverflow before, but the last relevant answer said this wasn't possible. I'm wondering if it's been made possible since.

Checklist

theluxury commented 2 months ago

Found the answer, it's the SearchPostsRequest method https://stackoverflow.com/a/78933430/2439391