Answers

How do I monitor a keyword on Xiaohongshu and collect new notes every day?

Short answer

Search the keyword on okdata with sort=latest once a day and stop paging when you reach notes older than your last run. Most brand keywords need one to three pages, so a keyword costs $0.02 to $0.06 a day, and ten keywords for a month at two pages each cost $12.00.

You want a morning list of every new Xiaohongshu note that mentions your brand, your competitor or a product name, so the social team can reply, repost or escalate before lunch. Searching by hand misses things, and the search page in the app mixes old popular notes with new ones. A daily search sorted by newest, stopped at your last run, produces that list.

The method

Use Xiaohongshu note search with sort=latest. Results come newest first, about 20 per page, each with published_at, title, text, images, author and counts.

  1. Run the search once a day (or every few hours for a launch).
  2. Keep notes whose published_at is after your last run.
  3. Stop paging as soon as a page reaches older notes, or an ID you already stored.

There is no date-range parameter, and you do not need one: sorting by latest and stopping at a timestamp gives you "the last 24 hours".

What it costs

Setup Calls per day Per day Per 30 days
1 keyword, usually 1 page 1 $0.02 $0.60
10 keywords, 2 pages each 20 $0.40 $12.00
Launch week: 5 keywords every 4 hours 30 $0.60 —

Script

import os, requests, datetime as dt

URL = "https://api.okdata.online/v1/xiaohongshu/notes/search"
HEAD = {"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"}
since = (dt.datetime.now(dt.timezone.utc) - dt.timedelta(days=1)).strftime("%Y-%m-%dT%H:%M:%S")
params, fresh = {"query": "某品牌 防晒", "sort": "latest"}, []

for _ in range(5):  # hard cap on pages
    body = requests.get(URL, headers=HEAD, params=params, timeout=60).json()
    items = body["data"]["items"]
    fresh += [n for n in items if n["published_at"] >= since]
    if not body["page"]["has_more"] or (items and items[-1]["published_at"] < since):
        break
    params["cursor"] = body["page"]["next_cursor"]
print(len(fresh), "new notes")

Run it from cron and send fresh to a group chat or a sheet.

Things to expect

  • Xiaohongshu search matches loosely; a short brand name also matches unrelated notes. Add a product word, or filter on title and text in your code.
  • Search results show the author but not their follower count. To flag notes from big accounts, look authors up with account profile.
  • Each page is one charge, and a page with nothing new still costs one call. Pick the run frequency to match how fast the keyword moves.

Other options

Social listening suites cover Xiaohongshu with dashboards and alerts and suit teams that want no code at all. MediaCrawler can run the same search with a logged-in account. For a broader setup with comments and creators, see word-of-mouth monitoring.

Updated