Output formats
The output contract every command shares: formats, fields, and templates.
Every read command renders through one formatter, so the same flags work
everywhere. Pick a format with -o, or let douyin choose: a table when writing
to a terminal, JSONL when piped.
Formats
douyin <command> -o table # aligned columns for reading
douyin <command> -o jsonl # one JSON object per line, for piping
douyin <command> -o json # a single JSON array
douyin <command> -o markdown # a Markdown table
douyin <command> -o csv # spreadsheet friendly
douyin <command> -o tsv # tab-separated
douyin <command> -o url # just the url field
douyin <command> -o raw # the record's body field, one per line
| Format | Best for |
|---|---|
table |
Reading on a terminal |
jsonl |
Piping into another tool, one object at a time |
json |
Loading a whole result as an array |
markdown |
Pasting a table into a document |
csv / tsv |
Spreadsheets and quick column math |
url |
Feeding URLs into other commands |
raw |
The record's text body (the word of a topic, the desc of a video, the text of a comment) |
Long text fields are truncated in table output to fit; json, jsonl, csv,
and tsv carry the full untruncated value.
Narrowing columns
Keep only the fields you want, by their lowercase JSON key:
douyin hot --fields rank,word,hot_value
--no-header drops the header row in table, csv, and tsv output, which
helps when a downstream tool expects bare rows.
Templating rows
For full control over each line, apply a Go text/template. Fields are the JSON keys, capitalised:
douyin hot --template '{{.Word}} {{.HotValue}}'
Why auto-detection helps
Because the default adapts to the destination, the same command reads well by hand and parses cleanly in a pipe:
douyin hot # a table, because this is a terminal
douyin hot | wc -l # JSONL, because this is a pipe
You only reach for -o when you want something other than that default.