Skip to main content

douyin-parse

CI License: MIT PyPI Python 3.10+

把抖音分享链接变成可读的文案:链接 → 文案.txt / 文案_分析版.md,附带画面文字(OCR)与一段 AI 可靠性分析。

dyparse parse "https://v.douyin.com/xxxxxx/"
  • 视频:Playwright 抓流 → FFmpeg 转 16k 单声道 → Whisper 转录 → 本地字典纠错 → RapidOCR 识屏
  • 图文:直接读页面文本,不下载、不 OCR
  • AI 可选:标点恢复 + 可靠性分析(任意 OpenAI 兼容接口),不配也能跑

dyparse 运行示例

上图是一次真实运行:20 秒短视频,全本地模式(--ai none --no-ocr)。

安装

需要 Python 3.10+ 和 ffmpeg。

# 推荐:隔离安装
pipx install "douyin-parse[all]"

# 或者用 uv
uv tool install "douyin-parse[all]"

# 也可以直接装进当前环境
pip install "douyin-parse[all]"

# 开发模式
git clone https://github.com/panghulo1994/douyin-parse.git
cd douyin-parse && pip install -e ".[all]"
playwright install chromium   # 非 Windows 或没装 Chrome 时需要

[all] 会带上 whisper 和 OCR 依赖;不想装那么多就只装 douyin-parse, 再按需补 pip install faster-whisper。

转录后端二选一,推荐 faster-whisper(CPU 快 3–4 倍,不用装 torch):

pip install faster-whisper     # 约 300 MB
# 或
pip install openai-whisper     # 会带入 torch,约 2.5 GB

dyparse doctor 会告诉你当前能用哪个。

装完先自检:

dyparse doctor

用法

dyparse parse "https://v.douyin.com/xxxx/"            # 单条
dyparse parse "https://v.douyin.com/xxxx/" -v         # 强制按视频解析
dyparse parse "https://v.douyin.com/xxxx/" --ai none  # 全本地,不调用 AI
dyparse batch links.txt                               # 批量,一行一个链接
dyparse transcribe ./a.mp4                            # 本地文件,不联网、不开浏览器
dyparse config --init                                 # 生成 .env 模板

常用参数:

参数 说明 默认
--out DIR 输出根目录 ./output
--model NAME tiny/base/small/medium/large-v3 small
--no-ocr 跳过画面文字提取 不跳过
--ai auto|none|deepseek|mimo AI 供应商 auto
--auto-number 按修改时间给输出目录统一编号 关
--backend NAME auto/faster-whisper/whisper auto
--headless 无头浏览器(服务器用) 关
--proxy URL 代理,如 http://127.0.0.1:7890 无
--user-agent UA 自定义 UA 浏览器默认
-v, --force-video 图文被误判时强制视频流程 关

也可以用环境变量:DOUYIN_OUTPUT_BASE / DOUYIN_WHISPER_MODEL / DISABLE_VIDEO_OCR / DOUYIN_AI_PROVIDER / AI_API_URL / AI_API_KEY / AI_MODEL。

Windows 上密钥只存在「用户环境变量」里也能读到(不需要重启终端)。

给 Agent 用(可选)

仓库带一个 skill:skills/douyin-parse/SKILL.md。复制到你的技能目录即可:

  • Claude Code:~/.claude/skills/douyin-parse/
  • DSH:~/.dsh/skills/douyin-parse/

skill 只约定「什么时候调用、怎么汇报」,解析仍然由 dyparse 完成。

产出

每条内容一个文件夹({标题}_{YYYYMMDD}):

文件 内容
文案.txt 修订、加标点后的纯正文
文案_分析版.md 标题 + 元信息表 + 正文 + AI 可靠性分析
画面文字.md 视频画面 OCR 出来的文字(有结果时)
修订报告.md ASR 字典修正记录(有修正时)
info.json 元数据 + 原始转录 + 分析 + OCR 文本
audio.wav 16kHz 单声道音频

速度

CPU 上实测(30 分钟视频,i9-14900HX):

模型 体积 转录耗时
small ≈460 MB 约为音频时长的 0.6 倍
large-v3 ≈2.9 GB 约为音频时长的 1.7 倍(30 分钟视频 ≈ 50 分钟)

长视频建议 --model small;追求准确度再用 large-v3。

平台

  • Windows:默认调用系统 Chrome(DOUYIN_BROWSER_CHANNEL=chrome),窗口会自动最小化
  • macOS / Linux:需要 playwright install chromium,窗口最小化自动跳过
  • 无图形界面服务器:加 --headless(抖音可能对无头浏览器更敏感,失败就换回有头)

现状

v0.1 把原先的单文件脚本拆成了模块:

cli / config / pipeline / extract / transcribe / ocr / media / browser
ai / render / correct / naming / batch / local / doctor

已完成:dyparse 命令行、跨平台配置目录、doctor 自检、单元测试、 faster-whisper 后端、本地文件模式、--headless。

尚未完成:

  • 失效自动检测(页面结构改版时给出明确提示)
  • 图形界面

发布流程(PyPI + Trusted Publishing)见 docs/发布.md。

  • 更多平台适配与失效自动检测

许可与免责声明

MIT。仅供个人学习与研究使用。

抓取行为可能违反平台用户协议,且会随平台改版失效;产出的文案、画面文字版权归原作者, 请勿再分发或用于商业用途。

Metadata

Release files for douyin-parse 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for douyin-parse 0.1.1
File Size Uploaded Provenance
douyin_parse-0.1.1.tar.gz 222.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for douyin-parse 0.1.1
File Interpreter ABI Platform
douyin_parse-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 297.0 kB

Release files / douyin_parse-0.1.1.tar.gz

Download URL douyin_parse-0.1.1.tar.gz
Size 222.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7a16122e896a9aaf9d3635f663573ae9938edd47a2b5b26d1d71c38553106e6d
BLAKE2b-256 checksum
How to use checksums
0568df07752373974c978796dcdbac3168bc993da28cfe2aa6c0d68abbdf2eae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / douyin_parse-0.1.1-py3-none-any.whl

Download URL douyin_parse-0.1.1-py3-none-any.whl
Size 74.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43b96ba223800b2d76c732fd05df5bed00b4715ba86a70fa9c4c05e518293cee
BLAKE2b-256 checksum
How to use checksums
54911187f4f9089d1afe44cc6ddfddd85d1223962bb77b59945e720a176062c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for douyin-parse 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for douyin_parse-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page