A command line for CSDN (CSDN博客), China's largest developer blog community.
csdn reads public CSDN data and prints clean, pipeable records. One pure-Go
binary, no API key, no login.
Install • Commands • Usage • Anti-bot • Serve • Docs
csdn reads the same public web surface a logged-out browser sees: the hot-rank
board, the blog search API, and the article, profile, post-list, and comment
endpoints the pages themselves call. CSDN serves all of it anonymously over plain
HTTPS with no request signing, so the tool carries no signer at all. It returns
records as a table, JSON, JSONL, CSV, TSV, or URLs, and serves the same read
operations over HTTP and MCP. Output is a table at a terminal and JSONL when
piped, so csdn hot | jq works with no flags.
csdn is an independent tool. It is not affiliated with, authorized, or endorsed
by CSDN (北京创新乐知网络技术有限公司).
go install github.com/tamnd/csdn-cli/cmd/csdn@latestOr with Homebrew:
brew install tamnd/tap/csdnOr grab a prebuilt binary from the releases, or run the container image:
docker run --rm ghcr.io/tamnd/csdn:latest hotShell completion is built in: csdn completion bash|zsh|fish|powershell.
Read operations work from the CLI, over HTTP (csdn serve), and over MCP
(csdn mcp).
| Command | Description |
|---|---|
hot |
Hot-rank board (CSDN热榜), in rank order |
search <query> |
Blog search hits (--type blog|all|ask|download|bbs) |
article <url|username/id> |
One article with its body |
user <username|url> |
A public profile |
posts <username|url> |
A user's published articles |
comments <url|username/id|id> |
Comments under an article |
| Command | Description |
|---|---|
serve |
Serve the read operations over HTTP (NDJSON) |
mcp |
Run as an MCP server over stdio |
raw <url> |
Fetch a URL and print its body untouched |
version |
Print version information |
csdn hot # hot-rank board, in rank order
csdn hot --fields rank,title,score -n 10 # pick the columns
csdn search golang -n 20 # blog search hits
csdn article LOVEmy134611/161870903 # one article with its body
csdn user LOVEmy134611 # a public profile
csdn posts LOVEmy134611 -n 10 # a user's articles
csdn hot -o json # JSON output
csdn hot | jq # JSONL piped to jqOutput is a table when you are at a terminal and JSONL when you pipe, so the
last line works with no flags. Every command takes the same global flags
(-o/--output, --fields, -n/--limit, --rate, --timeout, and more); see
the CLI reference for the full
surface.
CSDN is open: there is no request signing, and every read surface answers a plain
anonymous GET as long as the request carries a full browser header set. The one
failure mode is the anti-bot edge, which fronts a 521 status, a 403
cdn_cgi_bs_bot challenge, or an HTML challenge shell when it scores a caller as
non-browser. The tool is honest about this: it sends real browser headers, picks
the Referer each surface expects, and on a wall exits cleanly rather than emitting
a challenge page or faking data.
- Open from a normal IP, no key:
hot,search,article,user,postsall return real records. - Bot-walled under repeated or datacenter access:
commentsguards hardest and answers a sticky 403 from a datacenter IP. The command detects this and exits with code 4 (needs a residential session or a retry). The parser is correct and serves from a residential IP. The wall is at the IP and session layer, so no key the client could send opens it.
The read operations are also an HTTP API and an MCP server, backed by the same code as the CLI.
csdn serve # HTTP on :8080, NDJSON; /healthz and /v1/openapi.json
csdn mcp # MCP server over stdioFull documentation lives at csdn-cli.tamnd.com.
Apache-2.0. See LICENSE. csdn is an independent tool and is not
affiliated with CSDN.