Install
openclaw skills install xiaohongshu-demand-discovery-skillCollect recent high-interaction Xiaohongshu notes and cleaned comments using demand-style keywords for small-scale user need discovery and analysis.
openclaw skills install xiaohongshu-demand-discovery-skillThis is a Python Playwright based OpenClaw skill for Xiaohongshu/Rednote public-content workflows. It reads page data from Xiaohongshu web pages, mainly through window.__INITIAL_STATE__, and returns structured JSON.
It includes the original capabilities:
It also adds:
The demand discovery mode searches demand-style keywords, collects recent high-interaction notes and comments, cleans the data, removes raw user identity fields, and writes structured files for later LLM demand analysis or product-manager agent workflows.
This skill is a Xiaohongshu content and comment collection tool. The demand discovery collector can:
求推荐, 避雷, 平替, 真实测评, 后悔买, 踩坑--days windowpublish_time_unknownThis skill is not:
Use it for learning, research, internal product validation, and small-scale public-content collection.
Prefer demand-discovery when the user says things like:
Use search when the user only wants to search a Xiaohongshu keyword:
python -m scripts search "关键词"
Use feed when the user provides a concrete note id/link context and wants note detail or comments:
python -m scripts feed <feed_id> <xsec_token> --load-comments --max-comments=20
Use qrcode or check-login when login state is unknown or expired.
Do not use interaction or publishing commands for demand discovery. The collector itself does not call comment.py, interact.py, or publish.py.
Run all commands from the skill root directory.
pip install -r requirements.txt
playwright install chromium
On Linux/WSL, Chromium dependencies may also be required:
playwright install-deps chromium
First login by QR code:
python -m scripts qrcode --headless=false
Check login status:
python -m scripts check-login
If cookies expire, run the QR-code login again.
python -m scripts search "美食" --sort-by=最新 --note-type=图文 --publish-time=一周内 --limit=10
Common search options:
--sort-by: 综合, 最新, 最多点赞, 最多评论, 最多收藏--note-type: 不限, 视频, 图文--publish-time: 不限, 一天内, 一周内, 半年内--search-scope: 不限, 已看过, 未看过, 已关注--location: 不限, 同城, 附近--limit: returned result limitpython -m scripts feed <feed_id> <xsec_token>
python -m scripts feed <feed_id> <xsec_token> --load-comments --max-comments=20
python -m scripts explore --limit=20
The explore feed exists, but demand discovery should prefer keyword search in the first version.
python -m scripts user <user_id> [xsec_token]
python -m scripts me
Basic command:
python -m scripts demand-discovery
Small-scale test:
python -m scripts demand-discovery --keywords "求推荐" --posts-per-keyword 1 --search-limit 3 --max-comments 5 --headless=false
Specify multiple keywords:
python -m scripts demand-discovery --keywords "求推荐,避雷,平替" --posts-per-keyword 2 --search-limit 5 --max-comments 10 --headless=false
Use a keyword file:
python -m scripts demand-discovery --keywords-file keywords.txt
Important parameters:
--keywords: comma-separated keywords--keywords-file: UTF-8 text file, one keyword per line--days: recent-day window for note filtering, default 3--search-publish-time: Xiaohongshu search time filter, default 一周内--sort-by: default 最多评论, also supports 最多点赞--note-type: default 不限--posts-per-keyword: notes saved per keyword, default 3--search-limit: search results inspected per keyword, default 8--max-comments: valid comments saved per note, default 20--output-dir: output directory; default data/demand_discovery/<timestamp>/--timezone: default Asia/Shanghai--headless: true or falseDefault demand keywords:
求推荐
避雷
平替
真实测评
后悔买
踩坑
好用吗
怎么选
值不值得买
学生党
新手必备
替代品
不好用
怎么解决
Output files:
notes_clean.jsonl: one note-level record per saved/attempted notecomments_clean.jsonl: cleaned comment-level recordscollection_summary.json: machine-readable summary and counterscollector_report.md: human-readable reportThe collector uses one browser session per run:
XiaohongshuClient.start()LoginAction.check_login_status()SearchActionFeedDetailActionXiaohongshuClient.close()Demand discovery output must not save raw Xiaohongshu usernames, nicknames, avatars, or profile links. It writes author_hash instead:
sha256("xiaohongshu:" + raw_author_id)
The preferred raw author id is user_id. If unavailable, the collector may hash another available author field such as nickname or profile link, then discard the original value.
author_hash only for deduplication and structured analysis.comment.py, interact.py, or publish.py for demand discovery.python -m scripts qrcode --headless=false--headless=false, and confirm comments load on the note pagepublish_time_unknown: Xiaohongshu may have changed detail fields; inspect raw note detail structure before relying on recent-day filteringdemand-discovery uses pc_search as xsec_source; if this becomes unstable, test the original feed command behavior with pc_feed