v0.1.0
The first release of xhs, a command line for public Xiaohongshu data. One
pure-Go binary, no paid API key.
What it does
- Resolve notes, creator profiles, comments, search results, the recommendation
homefeed, related notes, and topics into flat records with stable snake_case
fields and afetched_attimestamp. - Stream results as JSONL, one record per line, or pick
table,json,csv,
tsv,yaml,url, orrawwith-o.--fieldsselects columns,
--templaterenders each record,-ncaps the count. - Parse ids, urls, and xsec_tokens out of any link with
xhs id, and pipe one
command into the next:xhs search coffee -o url | xhs note -. - Crawl connected records from seed notes into JSONL files with
xhs crawl.
How it talks to the site
xhs signs its own requests and bootstraps an anonymous web session, then caches
it on disk. The signer and the session are reimplemented from scratch by
observing the public web client; no third-party code is vendored.
Xiaohongshu blocks datacenter IP ranges and rate-limits every IP hard. From a
residential connection the public surfaces are reachable at the default polite
pace. Opening a note needs its xsec_token, which travels with the note in
listings and share URLs. The personalized surfaces need a logged-in cookie
passed with --cookie or XHS_COOKIE.
Install
go install github.com/tamnd/xiaohongshu-cli/cmd/xhs@latestOr download a prebuilt binary below, or run the container image:
docker run --rm ghcr.io/tamnd/xhs:0.1.0 --help