xiaohongshu-scraper
Skill4 starsChanged 3 months agoMITView on GitHub
Use when a user provides Xiaohongshu/XHS/xhslink URLs, asks to fetch 小红书 note or video content, likes, saves/collections, comments, publish metadata, or wants to fill a spreadsheet/Base from 小红书 links.
- Reads credentials
In this repository22 other files it gives its agents.
- aihotSkill
- bilibili-creator-finderSkill
- douyin-scraperSkill
- feishu-cli-managerSkill
- funcinating-guidesSkill
- funcinating-newsSkill
- hot-topicsSkill
- humanizerSkill
- humanizer-zhSkill
- imap-smtp-emailSkill
- lark-base-replicaSkill
- oss-uploadSkill
- seedance-promptSkill
- shopifySkill
- skill-publisherSkill
- skill-vetterSkill
- slider-captchaSkill
- tikhub-querySkill
- tiktok-scraperSkill
- video-downloadSkill
- wechat-scraperSkill
- weibo-scraperSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. About 0 are common, 8 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Use this skill for 小红书笔记链接抓取和表格回填.
- Distinctive: line 16
Use the dedicated Xiaohongshu browser profile and CDP endpoint when a logged-in visible browser is explicitly needed:
- Very specific: line 22
Do not use the default Chrome profile for Xiaohongshu scraping.
- Distinctive: line 28
Run the static scraper first:
- Very specific: line 40
If a URL returns only 小红书, 404, or 当前内容无法展示, retry with a real Chrome profile only when the user agrees:
- Very specific: line 51
Write only storage fields such as 正文, 点赞数, 收藏数, 抓取时间, and confirmed terminal 抓取状态.
- Very specific: line 73
Do not wrap scrape-xhs.mjs --browser in a shell loop for Base work.
- Very specific: line 77
Use 抓取状态 as the control plane:
- Very specific: line 89
Use 评论状态 as a separate operations queue.
- Very specific: line 101
When the row is marked 视频 or the note state contains video streams:
- Very specific: line 108
If MiniMax is configured, analyze the clearest frames with mmx vision describe:
- Distinctive: line 128
Do not bypass CAPTCHAs, paywalls, private content, account restrictions, or platform access controls.
- Distinctive: line 129
Do not export or print cookies, tokens, localStorage, QR codes, or profile secrets.
- Distinctive: line 130
Default to non-logged-in static/H5 scraping.
- Very specific: line 131
Do not repeatedly test rows already confirmed as inaccessible.
- Very specific: line 133
If using a visible CDP browser, use port 9223 and the Xiaohongshu profile only.
- Distinctive: line 134
Stop immediately after a platform warning or CAPTCHA/login-risk signal.
- Distinctive: line 135
Do not rotate IPs or use third-party proxies unless the user explicitly provides a compliant, owned proxy and the task is permitted.
- Very specific: line 139
Read references/strategy.md before changing crawl behavior, retry policy, browser profile usage, or Lark Base write semantics.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Xiaohongshu Scraper
Overview
Use this skill for 小红书笔记链接抓取和表格回填. Prefer reliable, low-frequency access patterns and preserve user intent: do not invent engagement numbers when the public page hides them.
Browser Profile
Use the dedicated Xiaohongshu browser profile and CDP endpoint when a logged-in visible browser is explicitly needed:
- CDP URL:
http://127.0.0.1:9223 - user-data-dir:
$HOME/Library/Application Support/Google/SocialScraperProfiles/Xiaohongshu - launcher:
~/.agents/social-browser-profiles/launch-social-chrome.sh xhs
Do not use the default Chrome profile for Xiaohongshu scraping. Do not share this port/profile with Douyin or Weibo jobs.
The Base entrypoint uses a local platform lock at /tmp/social-scraper-locks/xiaohongshu.lock; do not run two Xiaohongshu jobs at the same time from different sessions.
Workflow
- Extract canonical URLs from raw text, Markdown links, or Base cells.
- Run the static scraper first:
node ~/.agents/skills/xiaohongshu-scraper/scripts/scrape-xhs.mjs --json --delay-ms 6000 < urls.txt - For Lark Base batch work, use the safe Base entrypoint instead of shell loops:
node ~/.agents/skills/xiaohongshu-scraper/scripts/process-lark-xhs.mjs \ --base-token <base_token> \ --table-id <table_id> \ --view-id <view_id> \ --batch-size 10 - If a URL returns only
小红书,404, or当前内容无法展示, retry with a real Chrome profile only when the user agrees:node ~/.agents/skills/xiaohongshu-scraper/scripts/process-lark-xhs.mjs \ --base-token <base_token> \ --table-id <table_id> \ --view-id <view_id> \ --browser-confirm \ --chrome-user-data-dir "$HOME/Library/Application Support/Google/SocialScraperProfiles/Xiaohongshu" \ --batch-size 3 - For Lark Base updates, read the table fields first. Default runs process records whose
抓取状态is blank,准备抓取, or保持抓取. - Write only storage fields such as
正文,点赞数,收藏数,抓取时间, and confirmed terminal抓取状态. Uselark-basefor Base commands. - Process in very small batches. Default: 3-5 records when using a logged-in browser, 10 records only for static H5. Stop when failures cluster.
scrape-xhs.mjs --json Output
{"ok": true, "url": "...", "finalUrl": "...", "noteId": "6a35...",
"title": "...", "desc": "...", "body": "title\ndesc",
"noteType": "video|image", "publishedAt": 1781884007000,
"likedCount": 198, "collectedCount": 130, "commentCount": 8,
"imageUrls": ["https://sns-webpic-qc.xhscdn.com/..."]}authorId / authorName / authorUrl identify the note author (userId is the stable key; profile URL is built from it).
imageUrls takes the largest available rendition per image (H5_DTL > H5_PRV). The original
is not reachable — stripping the processing parameters returns 403, and every downloadable
rendition carries the Xiaohongshu watermark plus whatever caption the creator burned in. Treat
these images as internal reference only; they are not publishable assets.
Counts are null when the page omits them, unless --missing-count-as-zero is passed. A null
count means "not reported", not zero.
Do not wrap scrape-xhs.mjs --browser in a shell loop for Base work. It is a lower-level scraper; use process-lark-xhs.mjs so status filtering, failure fuses, and Base writes stay consistent.
Lark Status Rules
Use 抓取状态 as the control plane:
- blank/null: treat as
准备抓取. 准备抓取: new or newly appended row, eligible for first scraping. Fetch正文,点赞数,收藏数, and抓取时间.保持抓取: first scrape succeeded and data has been written; refresh only点赞数,收藏数, and抓取时间. Do not fetch or overwrite正文by default.抓取异常: confirmed inaccessible, app-only, login-wall, 404, repeated no-note-state, or platform warning risk. Do not retry automatically.停止抓取: manual or rule-based stop state for rows that no longer need engagement tracking.
Default runs scrape rows whose 抓取状态 is blank, 准备抓取, or 保持抓取. Treat blank as 准备抓取. When a 准备抓取 row succeeds, write the scraped body and engagement fields, then set 抓取状态 to 保持抓取. When a 保持抓取 row succeeds, update only engagement fields and 抓取时间; keep 正文 and 抓取状态 unchanged. When a row is confirmed failed after the allowed fallback path, set 抓取状态 to 抓取异常, write 抓取时间, and preserve existing useful values.
Comment Status Rules
Use 评论状态 as a separate operations queue. Keep it blank by default. The scraper may set 准备评论 only when a configured engagement threshold is reached or the user explicitly asks to queue rows for manual commenting; it must not publish Xiaohongshu comments automatically.
- blank/null: default, not yet selected for commenting.
准备评论: selected by threshold or manual review and waiting for human commenting on Xiaohongshu.取消评论: manually decided not to comment.评论成功: human comment has been posted.评论失败: a comment attempt failed and is not currently being retried.
For now, Xiaohongshu commenting is all manual. The skill can help surface candidates by writing 评论状态=准备评论, but comment publishing and final status changes are handled by the user. 准备评论 on Xiaohongshu means "ready for a human to comment", not "auto-comment now".
Video Notes
When the row is marked 视频 or the note state contains video streams:
- Download the video from the note's resolved stream URL when available, or use the local
video-downloadskill if the stream URL is not directly exposed. - Extract representative frames with ffmpeg:
ffmpeg -hide_banner -loglevel error -i video.mp4 -vf "fps=1/2,scale=720:-1" frames/frame_%03d.jpg - If MiniMax is configured, analyze the clearest frames with
mmx vision describe:mmx vision describe --region global --image frames/frame_001.jpg --prompt "请提取这帧里的字幕、画面主体和对理解小红书视频正文有用的信息。" - Combine title, original desc, visible captions, and visual summaries into
正文. Clearly mark inferred video content as【视频内容解析】.
MiniMax requires local authentication (MINIMAX_API_KEY or mmx auth login). If unavailable, fall back to manual frame review and say so. Video rows are higher risk and slower; process fewer per batch.
Output Rules
正文: title + newline + desc when both exist. Write this only for准备抓取rows unless the user explicitly requests body reprocessing.- For videos, append a concise
【视频内容解析】section when frame/video evidence is available. 点赞数/收藏数: refresh for both准备抓取and保持抓取rows. Leave unavailable values unchanged/null unless the user explicitly asks to treat hidden values as0.抓取时间: use the user's current local datetime rounded to minutes, e.g.YYYY-MM-DD HH:mm:00, when the Base field supports time.抓取状态: write保持抓取only after a successful准备抓取first scrape. Keep保持抓取unchanged during engagement refresh. Write抓取异常only after an access failure is confirmed and no automatic retry should happen. Never write停止抓取automatically unless a separate stop-tracking rule is explicitly enabled.评论状态: blank by default; write准备评论only when an engagement threshold or explicit user instruction selects the row for commenting. Xiaohongshu准备评论means a human should comment.- Preserve failed rows and report why they failed; do not overwrite useful existing values with blanks.
Safety And Access
- Do not bypass CAPTCHAs, paywalls, private content, account restrictions, or platform access controls.
- Do not export or print cookies, tokens, localStorage, QR codes, or profile secrets.
- Default to non-logged-in static/H5 scraping. Use the user's own logged-in Chrome profile only as a fallback after consent. Keep rate low and human-paced.
- Do not repeatedly test rows already confirmed as inaccessible. Mark them
抓取异常. - Browser mode must reuse one browser session for a batch; do not launch and close Chrome for each URL.
- If using a visible CDP browser, use port
9223and the Xiaohongshu profile only. - Stop immediately after a platform warning or CAPTCHA/login-risk signal.
- Do not rotate IPs or use third-party proxies unless the user explicitly provides a compliant, owned proxy and the task is permitted.
References
- Read
references/strategy.mdbefore changing crawl behavior, retry policy, browser profile usage, or Lark Base write semantics.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

