{"skill":{"slug":"xiaohongshu-extract","displayName":"xiaohongshu-extract","summary":"Extract metadata from Xiaohongshu (XHS) share or discovery URLs by parsing window.__INITIAL_STATE__ and returning note details. Use when asked to fetch XHS page content, note metadata, video info, or engagement stats from a public XHS link.","description":"---\nname: xiaohongshu-extract\ndescription: Extract metadata from Xiaohongshu (XHS) share or discovery URLs by parsing window.__INITIAL_STATE__ and returning note details. Use when asked to fetch XHS page content, note metadata, video info, or engagement stats from a public XHS link.\n---\n\n# Xiaohongshu Extract\n\n## Overview\n\nExtract note metadata (title, desc, type, time, user, engagement, tags, video stream info) from an XHS share or discovery URL using the bundled script.\n\n## Quick Start\n\nRun the extractor and print JSON to stdout:\n\n```bash\npython scripts/xiaohongshu_extract.py \"<xhs_url>\" --pretty\n```\n\nWrite JSON to a file:\n\n```bash\npython scripts/xiaohongshu_extract.py \"<xhs_url>\" --output /tmp/xhs_note.json\n```\n\nOutput only the flattened record:\n\n```bash\npython scripts/xiaohongshu_extract.py \"<xhs_url>\" --flat-only --pretty\n```\n\nWrite only the flattened record to a file:\n\n```bash\npython scripts/xiaohongshu_extract.py \"<xhs_url>\" --flat-only --output /tmp/xhs_flat.json\n```\n\nEmit errors as JSON:\n\n```bash\npython scripts/xiaohongshu_extract.py \"<xhs_url>\" --error-json\n```\n\nEmit errors as JSON to a file:\n\n```bash\npython scripts/xiaohongshu_extract.py \"<xhs_url>\" --error-json --output /tmp/xhs_error.json\n```\n\n## Workflow\n\n1. Run `scripts/xiaohongshu_extract.py` with the user-provided URL.\n2. If the script fails to find `window.__INITIAL_STATE__`, ask the user for a direct discovery URL.\n3. Use the JSON output to summarize note metadata or to feed downstream analysis.\n\n## Output Notes\n\nThe script returns a JSON object with:\n\n- `note_id`, `title`, `desc`, `type`, `time`, `ip_location`\n- `user` (nickname, user_id, avatar)\n- `interact` (liked/collected/comment/share counts, plus normalized *_num values)\n- `tags`\n- `video` (video_id, duration, width, height, fps, size, stream_url)\n- `field_mapping` (nested-to-flat field name map)\n- `flat` (flattened record with normalized counts and ISO timestamp)\n\nIf the stream list is empty, `video` fields may be null or empty.\n\nIf `--flat-only` is set, only `flat` is printed. If `--error-json` is set, errors are emitted as JSON and may include `final_url` and `status_code` when available.\n\n## Resources\n\n### scripts/\n\n- `scripts/xiaohongshu_extract.py` extracts note metadata from XHS share/discovery URLs.\n","tags":{"latest":"1.0.0","stable":"1.0.0"},"stats":{"comments":0,"downloads":2340,"installsAllTime":88,"installsCurrent":6,"stars":1,"versions":1},"createdAt":1770280173676,"updatedAt":1778486025837},"latestVersion":{"version":"1.0.0","createdAt":1770280173676,"changelog":"- Initial release of xiaohongshu-extract.\n- Extracts rich metadata from Xiaohongshu (XHS) share or discovery URLs, including note details, user info, engagement stats, tags, and video stream information.\n- Provides flexible JSON output options, including flattened records and error reporting.\n- Includes command-line script with multiple output modes for integration and downstream analysis.","license":null},"metadata":null,"owner":{"handle":"jovijovi","userId":"s172a7h9rdxd1ybv86bxqg16qd884a90","displayName":"jovijovi","image":"https://avatars.githubusercontent.com/u/1058245?v=4"},"moderation":null}