v0.1.0
First release of xhs.
The first release of xhs, a command line for public Xiaohongshu data.
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 a
fetched_attimestamp. - Stream large results as JSONL, one record per line, or pick any of
table,json,jsonl,csv,tsv,yaml,url,rawwith-o.--fieldsselects columns,--templaterenders each record,-ncaps the count. - Parse ids, urls, and xsec_tokens out of any xiaohongshu link with
xhs id, and pipe one command into the next with-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@latest
Or download a prebuilt binary from the release, or run
ghcr.io/tamnd/xhs:0.1.0.