douban-cli

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: Apache-2.0

README

douban

Search Douban books, movies, and music (豆瓣)

douban is a single pure-Go binary. It reads Douban's public search pages over plain HTTPS, extracts structured results from the embedded JSON, and pipes into the rest of your tools. No API key, nothing to run alongside it.

Install

go install github.com/tamnd/douban-cli/cmd/douban@latest

Or grab a prebuilt binary from the releases, or run the container image:

docker run --rm ghcr.io/tamnd/douban:latest --help

Usage

douban --help
douban version

# Search books (default)
douban search python
douban search "机器学习"

# Search movies
douban search "流浪地球" --type movie

# Search music
douban search "周杰伦" --type music --limit 5

# Output formats
douban search python -o json
douban search python -o jsonl | jq .url
douban search python -o csv

Output columns

Column Description
rank Result rank (1-based)
title Book/movie/music title
rating Score and review count, e.g. 9.1 (707)
abstract Author, publisher, year, price
url Douban subject URL

Development

cmd/douban/   thin main, wires cli.Root into fang
cli/          the cobra command tree
douban/       the library: HTTP client and data models
pkg/render/   table/json/jsonl/csv/tsv/url renderer
docs/         documentation site
make build      # ./bin/douban
make test       # go test ./...
make vet        # go vet ./...

Releasing

Push a version tag and GitHub Actions runs GoReleaser, which builds the archives, Linux packages, the multi-arch GHCR image, checksums, SBOMs, and a cosign signature:

git tag v0.1.0
git push --tags

The Homebrew and Scoop steps self-disable until their tokens exist, so the first release works with no extra secrets.

License

Apache-2.0. See LICENSE.

Directories

Path Synopsis
Package cli builds the douban command tree on top of the douban library.
Package cli builds the douban command tree on top of the douban library.
cmd
douban command
Command douban is a single-binary command line for douban-cli.
Command douban is a single-binary command line for douban-cli.
Package douban is the library behind the douban command: the HTTP client, request shaping, and typed data models for Douban (豆瓣).
Package douban is the library behind the douban command: the HTTP client, request shaping, and typed data models for Douban (豆瓣).
pkg
render
Package render turns slices of record structs into one of the output formats hackernews-cli supports: table, json, jsonl, csv, tsv, url, and raw.
Package render turns slices of record structs into one of the output formats hackernews-cli supports: table, json, jsonl, csv, tsv, url, and raw.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL