Token Narrative Pulse is a small Python script for crypto sentiment analysis. For a token watchlist it pulls X posts from the last 24 hours and Reddit threads with GET /web and site:reddit.com, and writes a daily report: mentions per token, unique authors, top posts and a bullish, bearish or neutral breakdown with cited links.
The problem
Crypto narratives move fast on X and Reddit. Analysts want a daily read on which tokens people talk about, how many different people, and in what tone, without bot spam inflating the numbers.
What the app does
- Takes a watchlist of tokens and terms.
- Pulls Top and Latest X posts per term from the last 24 hours.
- Runs a single Desearch web search for Reddit threads with
site:reddit.comin the query. - Runs AI Search on X only for a bullish, bearish and neutral breakdown with cited links.
- Counts mentions and unique authors per token.
- Flags duplicates and template bot posts.
- Writes a report, a CSV of posts and a mentions chart.
How it works
- X search.
GET /twitterthrough thedesearch-pySDKx_search, withsort=Topandsort=Latestper watchlist term andstart_dateset to yesterday (UTC). - Reddit web search. One
GET /webcall throughweb_search, withsite:reddit.complus watchlist terms joined withORas the query andstart=0. Keep only links whose host isreddit.comor a subdomain. Web search results have no post date, so Reddit threads are not limited to the last 24 hours. - AI Search on X. One
POST /desearch/ai/searchcall throughai_search, withtools=["twitter"]only,date_filter="PAST_24_HOURS"andresult_type="LINKS_WITH_FINAL_SUMMARY". A system message asks for a bullish, bearish and neutral breakdown with cited links. - Clean. Drop X posts older than 24 hours, plus duplicates and template bots.
- Write the report.
The code
The X search, Reddit web search and AI Search steps, copied from collect() in pulse.py:
async def collect(count, outdir, raw_dir):
now = dt.datetime.now(dt.timezone.utc)
since = now - dt.timedelta(hours=24)
start_date = since.strftime("%Y-%m-%d") # GET /twitter takes a UTC day, not a timestamp
costs, x_raw, ai_raw = [], {}, {}
async with Desearch(api_key=os.environ["DESEARCH_API_KEY"]) as ds:
print("X search (GET /twitter via desearch-py x_search):")
for label, (query, _) in WATCHLIST.items():
for sort in ("Top", "Latest"):
data = await timed(costs, f"x_search {query!r} sort={sort}",
ds.x_search(query=query, sort=sort, count=count,
start_date=start_date, include_metadata=True))
x_raw[f"{label}|{sort}"] = dump(data) or []
terms = " OR ".join(q for q, _ in WATCHLIST.values())
print("Reddit (GET /web via desearch-py web_search):")
data = await timed(costs, "web_search site:reddit.com",
ds.web_search(query=f"site:reddit.com {terms}", start=0, include_metadata=True))
ai_raw["web"] = dump(data) or {}
print("AI Search (POST /desearch/ai/search via desearch-py ai_search):")
data = await timed(costs, "ai_search tools=['twitter']",
ds.ai_search(prompt=f"What are people saying in the last 24 hours about {terms}?",
tools=["twitter"], date_filter="PAST_24_HOURS",
result_type="LINKS_WITH_FINAL_SUMMARY",
system_message=SYSTEM_MESSAGE, count=10,
include_metadata=True))
ai_raw["twitter"] = dump(data) or {}The folder has one script, pulse.py, a sample report in sample-output.md and the chart from that run.
Endpoints
GET /twitterGET /webPOST /desearch/ai/search
Example output
From a run on 2026-10-26 at 09:48 UTC with the default watchlist. All 10 calls succeeded. The X mention counts are deduplicated and inside the 24-hour window:
| Token | Mentions | Unique authors |
|---|---|---|
| TAO | 48 | 41 |
| Bittensor | 42 | 38 |
| Desearch (SN22) | 2 | 2 |
| Chutes (SN64) | 5 | 4 |
94 posts returned, 78 unique, 69 inside the window. These are counts inside a sample, not total X volume.
Web search returned 20 results, all on reddit.com.
AI Search returned 10 X posts from the last 24 hours and a bullish, bearish and neutral summary citing 10 links, all among those posts.
Run it yourself
The public examples folder linked above includes the script and a README. Install its requirements, set DESEARCH_API_KEY from console.desearch.ai, and use the run command in that README.
Useful flags: --count (posts per X query, default 20), --from-raw FILE (re-run with no API calls). Edit WATCHLIST in pulse.py to change tokens.
What it costs
One run with the default watchlist made 10 calls (8 X searches, 1 web search and 1 AI Search) and took about 45 seconds on 2026-10-26. See pricing.
Ideas to extend it
- Run it every morning and chart mentions over time.
- Alert when unique authors for a token jump.
- Add on-chain data next to the social view.