search_posts()#

Client.search_posts()#

Search posts globally by hashtag.

If you want to get the posts count only, see search_posts_count().

Usable by Users Bots
Parameters:
  • hashtag (str) – Text query string.

  • limit (int, optional) – Limits the number of posts to be retrieved. By default, no limit is applied and all posts are returned.

Returns:

Generator – A generator yielding Message objects.

Example

# Search for "#pyrogram". Get the first 50 results
async for message in app.search_posts("#pyrogram", limit=50):
    print(message.text)