Scripting with jq
Combine douyin with jq for flexible data extraction.
douyin outputs JSONL when piped, making it simple to process with jq.
# Print just the trending phrases
douyin hot | jq -r '.word'
# Phrase and hot value as a tab-separated pair
douyin hot | jq -r '[.word, .hot_value] | @tsv'
# Top 5 phrases over a hot-value threshold
douyin hot -n 5 | jq 'select(.hot_value > 10000000) | .word'
# Hot videos as CSV
douyin hot --tab video -n 10 -o csv
# Pull a few fields from one video (when reachable; walled off non-China IPs)
douyin video 7106594312292453675 | jq '{id, desc, digg_count}'
# Search result links only
douyin search 美食教程 | jq -r '.url'
The walled commands (video, user, posts, comments, search, and the
non-realtime hot tabs) exit 4 from a non-China or datacenter IP and emit no
records, so a downstream jq simply sees an empty stream. Check the exit code
in a script if you need to tell a wall apart from a genuinely empty result. See
troubleshooting for the exit-code meanings.