From xhs-news
This skill should be used when the user asks to "browse xiaohongshu", "scrape xiaohongshu", "get news from xiaohongshu", "extract xiaohongshu posts", "浏览小红书", "小红书新闻", "小红书热点", or needs to automate content extraction from xiaohongshu.com (小红书). Provides the workflow, page structure knowledge, and JavaScript extraction patterns for reliably browsing and extracting post content from xiaohongshu.com using agent-browser.
How this skill is triggered — by the user, by Claude, or both
Slash command
/xhs-news:xhs-browsingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Automate browsing xiaohongshu.com to search for topics, extract post content, and compile structured summaries using agent-browser.
Automate browsing xiaohongshu.com to search for topics, extract post content, and compile structured summaries using agent-browser.
agent-browser plugin must be installed and availableFirst-time login:
agent-browser --headed --session-name xiaohongshu open https://www.xiaohongshu.com/explore
agent-browser --session-name xiaohongshu state save xiaohongshu-auth.json
Returning sessions:
agent-browser --session-name xiaohongshu state load xiaohongshu-auth.json
agent-browser --session-name xiaohongshu open https://www.xiaohongshu.com/explore
Navigate to search results using a URL with encoded keyword. Always quote the URL to prevent shell expansion:
agent-browser --session-name xiaohongshu open 'https://www.xiaohongshu.com/search_result?keyword=<ENCODED_KEYWORD>&source=web_search_result_notes&type=51'
Wait for the page to load:
agent-browser --session-name xiaohongshu wait --load networkidle
Use JavaScript evaluation to extract post metadata from the search results page. Use eval --stdin with heredoc to avoid shell quoting issues.
Refer to references/extract-scripts.md for the complete extraction scripts.
The key extraction pattern targets section.note-item elements and extracts title, author, likes count, and the a.cover link href (which includes the xsec_token parameter needed for access).
Critical: Do NOT navigate directly to /explore/<id> URLs — these will return 404 due to anti-scraping protection. Instead, click post cards via JavaScript from the search results page:
agent-browser --session-name xiaohongshu eval --stdin <<'EVALEOF'
document.querySelectorAll('section.note-item')[INDEX].querySelector('a.cover').click();
'clicked'
EVALEOF
Wait 3 seconds for the modal to load, then extract content from the detail overlay:
agent-browser --session-name xiaohongshu eval --stdin <<'EVALEOF'
const noteContainer = document.querySelector('.note-detail-mask')
|| document.querySelector('[class*="note-detail"]')
|| document.querySelector('.note-scroller');
const content = noteContainer ? noteContainer.innerText : 'not found';
content.substring(0, 3000);
EVALEOF
Close the modal with Escape before opening the next post:
agent-browser --session-name xiaohongshu press Escape
Sort posts by engagement (likes count) and prioritize:
Aim to extract 8-12 high-quality posts per search session.
Organize extracted content into a structured Markdown report with these sections:
Save the report as a Markdown file with naming convention: xhs-<topic>-<YYYYMMDD>.md
--session-name xiaohongshu for session persistence across commandseval --stdin <<'EVALEOF' for all JavaScript to avoid shell escaping issuesxsec_token in search result links is session-bound; do not reuse across sessionsreferences/extract-scripts.md — Complete JavaScript extraction code snippets for post lists and post contentnpx claudepluginhub 8de4732a/xhs-news --plugin xhs-newsExtracts Xiaohongshu post content including text, images, and video transcripts via Whisper, formats as Markdown, and saves to Obsidian vault. Use with post URLs.
Searches Xiaohongshu content by keyword via HTTP API with filters for sort order, note type, publish time, scope, and location.
Create viral Xiaohongshu (小红书) content with platform-native strategy, save-rate optimization, trending formats, and search SEO for China's #1 lifestyle platform.