支持抖音开放平台官方 OpenAPI 的命令行工具。
Project description
✨douyin-cli
📢声明
本项目是面向抖音开放平台官方 OpenAPI 的命令行工具,同时保留部分公开网页数据处理能力,仅用于测试和学习研究,禁止用于商业用途或任何非法用途。
任何用户直接或间接使用、传播本仓库内容时责任自负,本仓库的贡献者不对该等行为产生的任何后果负责。
如果相关方认为该项目的代码可能涉嫌侵犯其权利,请及时联系我删除相关代码。
使用本仓库的内容即表示您同意本免责声明的所有条款和条件。如果你不接受以上的免责声明,请立即停止使用本项目。
🍬功能特性
- ✅ 官方 OpenAPI:支持通过
douyin api调用抖音开放平台官方接口 - ✅ Token 获取:支持
client_token与 OAuthaccess_token获取流程 - ✅ 通用请求:支持任意官方 OpenAPI 路径、查询参数、JSON body、表单和自定义请求头
- ✅ 环境变量:支持
DOUYIN_CLIENT_KEY、DOUYIN_CLIENT_SECRET、DOUYIN_ACCESS_TOKEN - ✅ 本地字幕:可选安装
faster-whisper,从视频/音频生成 SRT/VTT/TXT/JSON 字幕 - ✅ 命令行安装:通过
uv tool install .安装为本机douyin命令 - ✅ 兼容能力:保留旧版网页数据命令,适合已有脚本迁移
🚀快速开始
环境要求
- Python 3.13
- uv 0.9+
- 抖音开放平台应用的
client_key/client_secret - Node.js(仅旧版网页数据命令需要)
- aria2c(可选,仅旧版下载命令需要)
安装命令
uv tool install -e . # 开发者
uv tool install douyin-cli # 用户
uv tool install 'douyin-cli[subtitle]' # 启用本地字幕
官方 OpenAPI
# 获取 client_token
douyin api client-token \
--client-key "$DOUYIN_CLIENT_KEY" \
--client-secret "$DOUYIN_CLIENT_SECRET"
# 用 OAuth code 换 access_token
douyin api access-token \
--client-key "$DOUYIN_CLIENT_KEY" \
--client-secret "$DOUYIN_CLIENT_SECRET" \
--code "授权码"
# 调用任意官方 OpenAPI 路径
douyin api request GET /oauth/userinfo/ \
--token "$DOUYIN_ACCESS_TOKEN" \
--param open_id=xxx
本地字幕
douyin subtitle video.mp4
douyin subtitle video.mp4 --language zh --model small --format srt
douyin subtitle video.mp4 --model Systran/faster-whisper-small --model-cache-dir ~/.cache/douyin-cli/models
字幕由本地 faster-whisper 转写生成,默认输出同名 .srt 文件。首次使用模型时会自动从 Hugging Face 下载;网络受限时可设置 HF_ENDPOINT 或提前缓存模型。
📖 详细使用说明请查看 USAGE.md
📊 技术栈
- 运行时: Python 3.13
- 命令行: Click
- 官方接口: 抖音开放平台 OpenAPI
- 字幕识别: faster-whisper(可选)
- HTTP 客户端: niquests
Star History
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file douyin_cli-2026.5.28.3.tar.gz.
File metadata
- Download URL: douyin_cli-2026.5.28.3.tar.gz
- Upload date:
- Size: 37.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e08396fdcc4debe6ddfbcd824733f12013d4997c961a183cc91c249f5fd7b1e
|
|
| MD5 |
97f0b1d2465063f69e8836718e35b8e3
|
|
| BLAKE2b-256 |
8b8433a27f5e49315e9c0f494e357a4a99b7dd81d126cce0d3840e81a63373ff
|
File details
Details for the file douyin_cli-2026.5.28.3-py3-none-any.whl.
File metadata
- Download URL: douyin_cli-2026.5.28.3-py3-none-any.whl
- Upload date:
- Size: 45.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f47befb17c59b25f272cfe1b3ea9063a5043e86addddf5a9611b76bfc4fb49be
|
|
| MD5 |
f1970be32a8064adae626f092aae4d7a
|
|
| BLAKE2b-256 |
373522e0da3503e3661a44ece57f2314635cc3d77e2083f3e90069a2e5c48b1d
|