search_global_hashtag_messages()

Client.search_global_hashtag_messages()

Search public channel posts with a given hashtag and/or text query.

For the count only, see search_global_hashtag_messages_count().

Usable by Users Bots

Parameters:
  • hashtag (str, optional) – Hashtag to search for.

  • query (str, optional) – Additional free-text search query (Layer 207+).

  • offset_id (int, optional) – Offset message ID for pagination.

  • offset_date (datetime, optional) – Return only messages older than this date.

  • limit (int, optional) – Maximum number of messages to return. Defaults to 0 (no limit).

  • allow_paid_stars (int, optional) – Maximum Stars budget for paid-broadcast results (Layer 207+). Pass None to exclude paid results.

Returns:

AsyncGenerator – Yields Message objects.

Example

async for message in app.search_global_hashtag_messages("#pyrogram"):
    print(message.text)