Skip to main content

支持抖音开放平台官方 OpenAPI 的命令行工具。

Project description

douyin-cli

✨douyin-cli

❤️开源不易,欢迎star⭐

📢声明

本项目是面向抖音开放平台官方 OpenAPI 的命令行工具,同时保留部分公开网页数据处理能力,仅用于测试和学习研究,禁止用于商业用途或任何非法用途。

任何用户直接或间接使用、传播本仓库内容时责任自负,本仓库的贡献者不对该等行为产生的任何后果负责。

如果相关方认为该项目的代码可能涉嫌侵犯其权利,请及时联系我删除相关代码

使用本仓库的内容即表示您同意本免责声明的所有条款和条件。如果你不接受以上的免责声明,请立即停止使用本项目。


🍬功能特性

  • 官方 OpenAPI:支持通过 douyin api 调用抖音开放平台官方接口
  • Token 获取:支持 client_token 与 OAuth access_token 获取流程
  • 通用请求:支持任意官方 OpenAPI 路径、查询参数、JSON body、表单和自定义请求头
  • 环境变量:支持 DOUYIN_CLIENT_KEYDOUYIN_CLIENT_SECRETDOUYIN_ACCESS_TOKEN
  • 命令行安装:通过 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 # 用户

官方 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

📖 详细使用说明请查看 USAGE.md

📊 技术栈

  • 运行时: Python 3.13
  • 命令行: Click
  • 官方接口: 抖音开放平台 OpenAPI
  • HTTP 客户端: niquests

Star History

Star History Chart

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

douyin_cli-2026.5.28.tar.gz (35.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

douyin_cli-2026.5.28-py3-none-any.whl (44.9 kB view details)

Uploaded Python 3

File details

Details for the file douyin_cli-2026.5.28.tar.gz.

File metadata

  • Download URL: douyin_cli-2026.5.28.tar.gz
  • Upload date:
  • Size: 35.8 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

Hashes for douyin_cli-2026.5.28.tar.gz
Algorithm Hash digest
SHA256 18c045d522d6947d39b2108d0e15527a9ce583b0e5b54f594ba8b4554a6c21ed
MD5 f14d1e23e5c4d908f4dee867823d245d
BLAKE2b-256 2b8a1fd2d33318a231035202dd3e3c95b9144770ae0fab5346ab13af2465d617

See more details on using hashes here.

File details

Details for the file douyin_cli-2026.5.28-py3-none-any.whl.

File metadata

  • Download URL: douyin_cli-2026.5.28-py3-none-any.whl
  • Upload date:
  • Size: 44.9 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

Hashes for douyin_cli-2026.5.28-py3-none-any.whl
Algorithm Hash digest
SHA256 0ce49de000dafb09d77be6a1711a2734624f89a38c1f4c4b96aa81635d88d09b
MD5 8e6cfcb31f2a614a57f70dad96e83dc4
BLAKE2b-256 90e949b7ae9c6f89cc6ddad635132696d54c37be1d3e3738b2fe50ef5bdd7eed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page