Skip to content

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 13 Jun 16:34
· 2 commits to main since this release
v0.1.0
1508229

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 a fetched_at timestamp.
  • Stream results as JSONL, one record per line, or pick table, json, csv,
    tsv, yaml, url, or raw with -o. --fields selects columns,
    --template renders each record, -n caps 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@latest

Or download a prebuilt binary below, or run the container image:

docker run --rm ghcr.io/tamnd/xhs:0.1.0 --help