Say you want every public Telegram post that mentions your brand, a coin or a product. Telegram's global search only works inside the app, with an account. The official API (and libraries like Telethon) also needs a phone number and a session.
Without an account you have two public routes: Google, and Telegram's own search inside each channel. I measured both. Google found a fraction of the posts, and the posts it did find were often weeks old.
Route 1: Google (site:t.me)
The obvious trick is a Google search like site:t.me "Hyperliquid". It works, but:
- Google mostly indexes channel pages, not individual posts.
- It lags behind new posts by days or weeks.
- You can't page through thousands of results.
Here is what I found on 15 November 2026 with the same three keywords, counting only posts that contain the exact phrase:
| Keyword | Posts found via Google's index | Posts found by searching inside channels | Newest post: Google / inside channels |
|---|---|---|---|
| bitcoin ETF | 8 | 53 | 2025-12-03 / 2026-11-13 |
| Solana | 0 | 59 | - / 2026-11-12 |
| Hyperliquid | 28 | 102 | 2026-11-13 / 2026-11-13 |
For "bitcoin ETF" the newest post Google knew about was almost a year old. Searching inside the channels found posts from two days earlier.
So Google is useful for one thing: finding which channels talk about your keyword. Not for finding the posts.
Route 2: search inside each channel
Every public channel has a web preview at https://t.me/s/<channel>, and it supports search: https://t.me/s/<channel>?q=<keyword>. No login. It returns up to 20 matching posts per page, newest first, with the same HTML as the normal channel page.
pip install requests beautifulsoup4
import re
import requests
from bs4 import BeautifulSoup
def post_text(msg):
"""Post text without the quoted reply. No separator in get_text(): on search
pages Telegram wraps every matched word in <mark>, so 'end-to-end' arrives as
<mark>end</mark>-<mark>to</mark>-<mark>end</mark>."""
parts = []
for el in msg.select(".tgme_widget_message_text"):
if el.find_parent(class_="tgme_widget_message_reply"):
continue
for br in el.find_all("br"):
br.replace_with("\n")
parts.append(el.get_text())
return re.sub(r"\s+", " ", " ".join(parts)).strip()
def search_channel(channel, keyword):
"""Telegram's own in-channel search, then keep only posts that contain the phrase."""
url = f"https://t.me/s/{channel}"
html = requests.get(url, params={"q": keyword}, headers={"User-Agent": "Mozilla/5.0"}, timeout=20).text
soup = BeautifulSoup(html, "html.parser")
returned, exact = [], []
for msg in soup.select(".tgme_widget_message[data-post]"):
text = post_text(msg)
returned.append(msg["data-post"])
if keyword.lower() in text.lower():
exact.append({"post": msg["data-post"], "text": text[:80]})
return returned, exact
returned, exact = search_channel("durov", "end-to-end encryption")
print(f"Telegram returned {len(returned)} posts, {len(exact)} contain the exact phrase")
On 18 November 2026 this printed: Telegram returned 7 posts, 4 contain the exact phrase.
That's the catch with channel search: it matches the words separately. A post that says "end-to-end" in one sentence and "encryption" in another counts as a hit. If you're building mention alerts, you need to check the phrase yourself (and decide whether #hashtag versions count).
The skip on .tgme_widget_message_reply matters too: without it, a post that merely replies to a matching post would count as a match because the quoted text is in the same HTML.
One more trap: on search pages Telegram highlights every matched word with a <mark> tag, so "end-to-end encryption" arrives as <mark>End</mark>-<mark>to</mark>-<mark>End</mark> <mark>Encryption</mark>. If you extract text with get_text(" ", strip=True), you get End - to - End Encryption and the phrase check fails on every post. My first version of this snippet did exactly that and reported 0 exact matches. Use get_text() without a separator (and turn <br> into newlines yourself), as above.
Putting it together
A keyword monitor that actually works needs three steps:
-
Find channels for the keyword (Google
site:t.me, plus channels that matching posts were forwarded from or link to). -
Search inside every channel with
?q=, page by page. - Keep only real matches, and for monitoring, remember the newest post you've seen per channel and keyword so the next run returns only new mentions.
Step 1 is the expensive one: Google results need a SERP proxy, and you don't want to pay for discovery every hour. Caching the channel list for a day is a good trade-off.
The hosted version
I run this as an Apify Actor: Telegram Keyword Search Scraper. You give it keywords; it finds the channels, searches inside each one, keeps only exact matches (and tells you how each post matched), and has an Only new posts mode for scheduled mention alerts. Channel discovery is reused for 24 hours, so an hourly schedule pays for discovery at most once a day.
Test run on 15 November 2026 (keywords bitcoin ETF, Solana, Hyperliquid, 100 posts per keyword): 259 matching posts from 19 channels in 2 minutes, 98 of them from the last 7 days. 211 search results that didn't contain the exact phrase were filtered out and not charged.
from apify_client import ApifyClient
client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("datalume/telegram-keyword-search-scraper").call(run_input={
"keywords": ["Hyperliquid"],
"maxPostsPerKeyword": 50,
"onlyNewPosts": True,
})
for post in client.dataset(run["defaultDatasetId"]).iterate_items():
print(post["date"], post["channel"], (post["text"] or "")[:80])
As an MCP tool for Claude or Cursor: https://mcp.apify.com?tools=datalume/telegram-keyword-search-scraper.
If you already know the channels and just want all their posts, see How to Scrape a Public Telegram Channel in Python.
I run datalume, a small set of public-data scrapers on Apify. This post was written with AI assistance; the numbers come from real runs on the dates shown. Not affiliated with Telegram.
Top comments (0)