Skill: pengluday/xiaohongshu-collector (version 1.0.0)

--- name: xiaohongshu-collector description: Work on Xiaohongshu post/comment collection, cookie handling, refresh flows, and browser plugin integration in the forbidden_company repo. --- # Xiaohongshu Collector ## Overview Use this skill when working on Xiaohongshu collection in `forbidden_company`, especially for post bodies, comment pagination, cookie updates, single-URL refreshes, or browser-plugin integration. ## What To Use Prefer the existing repo implementation instead of inventing a new flow: - `scripts/collect_xiaohongshu.py` - `scripts/admin_server.py` - `scripts/run_xiaohongshu_collection.sh` - [REDACTED_SECRET] - `docs/xiaohongshu-collector.md` - `docs/xhs-plugin-api.md` ## Core Rules - Keep cookies private. Never repeat them in final output. - `comment_limit=0` means collect all available comments. - Comment collection must paginate. - If the direct comment API returns a login/account error, use the browser-rendered fallback. - Do not rely on Firecrawl for comment pagination. ## Workflow 1. Confirm whether the task is batch collection or single-URL refresh. 2. Load the saved cookie from `data/xiaohongshu-cookie.txt` unless a newer cookie is provided. 3. Run or update `scripts/collect_xiaohongshu.py` with the requested URL(s), `--db`, `--refresh-url`, and `--comment-limit 0` when full comments are needed. 4. For browser plugin work, wire the popup/background scripts to the local backend endpoints in `scripts/admin_server.py`. 5. Verify that post rows, comment rows, and exported artifacts are written correctly. ## Endpoint Map Use these backend endpoints when integrating the browser plugin: - `GET/POST /api/xhs-cookie` - `GET /api/xhs-plugin/status` - `POST /api/xhs-plugin/collect` - `POST /api/xhs-plugin/refresh` ## Validation Notes - Refresh mode must delete the old note rows before writing the new ones. - The plugin should expose downloadable CSV and JSON artifacts. - When debugging, check whether the failure is cookie-related, pagination-related, or page-structure related. ## Safety Notes - Do not propose or implement shared-server mass scraping. - Keep the browser/plugin model user-driven and local-first. - Preserve source URLs and timestamps for traceability. ## Reference See [collector-workflow.md](references/collector-workflow.md) for operational details.

path: references/collector-workflow.md
content: # Xiaohongshu Collector Workflow

## Scope
Use this skill when you need to work on Xiaohongshu post/comment collection in the `forbidden_company` repo, especially:
- collecting posts and comments from note URLs
- refreshing a single Xiaohongshu URL
- updating or reading the saved cookie
- wiring the browser plugin to the local backend
- debugging comment pagination or login failures

## Canonical Files
Prefer the existing repo files before inventing new flows:
- `scripts/collect_xiaohongshu.py`
- `scripts/admin_server.py`
- `scripts/run_xiaohongshu_collection.sh`
- `browser-extension/xhs-collector/`
- `docs/xiaohongshu-collector.md`
- `docs/xhs-plugin-api.md`

## Collection Rules
- Treat the browser cookie as sensitive. Never echo it back in final output.
- `comment_limit=0` means "collect all available comments".
- Comment collection must support pagination.
- If the direct comment API returns an auth or account error, prefer the browser-rendered fallback.
- Do not rely on Firecrawl for comment pagination; it is only a post-body fallback.

## Recommended Workflow
1. Confirm the note URL and whether the user wants a one-off refresh or a batch run.
2. Read the saved cookie from `data/xiaohongshu-cookie.txt` unless the user provides a newer cookie.
3. Run or update `scripts/collect_xiaohongshu.py` with:
   - `--input-urls`
   - `--output-csv`
   - `--db` when persistence is needed
   - `--refresh-url` for replacing one existing note
   - `--comment-limit 0` for full comment collection
4. If comment collection fails, check whether:
   - cookie is missing or stale
   - the browser fallback is unavailable
   - the page returns a platform auth/account error
5. For backend integration, use the plugin endpoints in `scripts/admin_server.py`:
   - `GET/POST /api/xhs-cookie`
   - `GET /api/xhs-plugin/status`
   - `POST /api/xhs-plugin/collect`
   - `POST /api/xhs-plugin/refresh`

## Result Handling
- Post rows and comment rows are written into the same evidence table/CSV flow.
- Refresh mode must delete the old note rows before writing the new ones.
- Plugin results should expose downloadable CSV and JSON artifacts.

## Safety Notes
- Never propose or implement centered mass scraping from a shared server IP.
- Keep the browser/plugin model user-driven and local-first.
- Preserve source URLs and timestamps for traceability.


path: agents/openai.yaml
content: interface:
  display_name: "Xiaohongshu Collector"
  short_description: "Collect Xiaohongshu posts, comments, and refresh flows"
  default_prompt: "Use $xiaohongshu-collector to update Xiaohongshu post/comment collection, cookie handling, refresh flows, or the browser plugin integration."
policy:
  allow_implicit_invocation: true


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)