# ahang008/ah-douyin-clean-downloader architecture

> Architecture diagram of the GitHub repository ahang008/ah-douyin-clean-downloader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahang008/ah-douyin-clean-downloader
- Repository: https://github.com/ahang008/ah-douyin-clean-downloader

## Overview

This repository is a Codex Skill for authorized Douyin media workflows: downloading a single original video, preparing a corrected transcript, archiving a creator’s public works, and rewriting an existing library into speech-ready scripts. The graph keeps those user-facing branches distinct and includes the browser/network support layer. README statements establish the documented workflows; source excerpts show selected implementation details, but several creator-archive and export connections are not independently verified in sampled code.

Main entry points: [`scripts/run_creator.py`](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/run_creator.py) (Creator workflow runner), [`scripts/transcribe_douyin.py`](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/transcribe_douyin.py) (Transcript preparation), [`scripts/download_batch.py`](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/download_batch.py) (Batch downloader), [`scripts/download_douyin.py`](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/download_douyin.py) (Single downloader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_single["Single video"]
  node_single_download["Single downloader<br/>[download_douyin.py]"]
  node_single_transcript["Transcript preparation"]
  node_local_asr["Local ASR"]
  node_corrected_docs["Corrected Markdown / SRT"]
end

subgraph group_creator["Creator archive"]
  node_creator_runner["Creator workflow runner<br/>[run_creator.py]"]
  node_browser_collector["Public catalog collector"]
  node_catalog["Creator catalog"]
  node_batch_download["Batch downloader<br/>[download_batch.py]"]
  node_detail_recovery["Official detail recovery"]
  node_cover_metadata["Cover and caption metadata"]
  node_creator_metrics["Creator metrics<br/>[work_metrics.py]"]
  node_transcript_export["Transcript export"]
  node_library[("Local media library")]
end

subgraph group_writing["Transcript and rewrite"]
  node_rewrite_helper["Rewrite batch preparation<br/>[batch_rewrite.py]"]
  node_codex_rewrite["Codex draft rewriting"]
  node_rewrite_outputs["Speech scripts and indexes"]
end

subgraph group_support["Browser and network"]
  node_browser_launcher["Dedicated browser launcher"]
  node_dns_proxy["Browser DNS proxy"]
end

node_user(("User / Codex"))
node_douyin["Douyin"]

node_user -->|"requests download"| node_single_download
node_single_download -->|"fetches playback source"| node_douyin
node_user -->|"requests transcript"| node_single_transcript
node_single_transcript -->|"downloads source"| node_single_download
node_single_transcript -->|"runs recognition"| node_local_asr
node_single_transcript -->|"prepares draft for correction"| node_corrected_docs
node_user -->|"requests creator archive"| node_creator_runner
node_creator_runner -.->|"collects public catalog"| node_browser_collector
node_browser_collector -->|"saves catalog"| node_catalog
node_creator_runner -.->|"downloads works"| node_batch_download
node_batch_download -->|"retrieves media"| node_douyin
node_batch_download -->|"stores original media"| node_library
node_creator_runner -.->|"recovers missing details"| node_detail_recovery
node_creator_runner -.->|"collects captions and cover text"| node_cover_metadata
node_catalog -->|"provides catalog input"| node_cover_metadata
node_creator_runner -.->|"generates metrics"| node_creator_metrics
node_creator_runner -.->|"exports transcripts"| node_transcript_export
node_library -->|"supplies existing library"| node_rewrite_helper
node_user -->|"requests batch rewrite"| node_rewrite_helper
node_rewrite_helper -->|"prepares writing shards"| node_codex_rewrite
node_codex_rewrite -->|"writes scripts and indexes"| node_rewrite_outputs
node_browser_launcher -->|"starts when needed"| node_dns_proxy
node_browser_launcher -.->|"supports browser collection"| node_browser_collector

click node_single_download "https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/download_douyin.py"
click node_single_transcript "https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/transcribe_douyin.py"
click node_local_asr "https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/transcribe_local.py"
click node_creator_runner "https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/run_creator.py"
click node_browser_collector "https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/collect_creator_browser.py"
click node_browser_launcher "https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/launch_browser_collector.py"
click node_dns_proxy "https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/browser_dns_proxy.py"
click node_batch_download "https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/download_batch.py"
click node_detail_recovery "https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/recover_official_web_detail.py"
click node_cover_metadata "https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/collect_cover_metadata.py"
click node_creator_metrics "https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/work_metrics.py"
click node_transcript_export "https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/export_transcripts.py"
click node_rewrite_helper "https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/batch_rewrite.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_single_download,node_single_transcript,node_local_asr,node_corrected_docs,node_user toneBlue
class node_creator_runner,node_browser_collector,node_catalog,node_batch_download,node_detail_recovery,node_cover_metadata,node_creator_metrics,node_transcript_export,node_library toneAmber
class node_rewrite_helper,node_codex_rewrite,node_rewrite_outputs toneMint
class node_browser_launcher,node_dns_proxy toneRose
class node_douyin toneIndigo
```

## Components

### Single video

- [Single downloader](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/download_douyin.py): `scripts/download_douyin.py`
- [Transcript preparation](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/transcribe_douyin.py): `scripts/transcribe_douyin.py`
- [Local ASR](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/transcribe_local.py): `scripts/transcribe_local.py`
- **Corrected Markdown / SRT**

### Creator archive

- [Creator workflow runner](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/run_creator.py): `scripts/run_creator.py`
- [Public catalog collector](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/collect_creator_browser.py): `scripts/collect_creator_browser.py`
- **Creator catalog**
- [Batch downloader](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/download_batch.py): `scripts/download_batch.py`
- [Official detail recovery](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/recover_official_web_detail.py): `scripts/recover_official_web_detail.py`
- [Cover and caption metadata](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/collect_cover_metadata.py): `scripts/collect_cover_metadata.py`
- [Creator metrics](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/work_metrics.py): `scripts/work_metrics.py`
- [Transcript export](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/export_transcripts.py): `scripts/export_transcripts.py`
- **Local media library**

### Transcript and rewrite

- [Rewrite batch preparation](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/batch_rewrite.py): `scripts/batch_rewrite.py`
- **Codex draft rewriting**
- **Speech scripts and indexes**

### Browser and network

- [Dedicated browser launcher](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/launch_browser_collector.py): `scripts/launch_browser_collector.py`
- [Browser DNS proxy](https://github.com/ahang008/ah-douyin-clean-downloader/blob/main/scripts/browser_dns_proxy.py): `scripts/browser_dns_proxy.py`

### Other components

- **User / Codex**
- **Douyin**

## Connections

- User / Codex → Single downloader: requests download (evidence: `README.md`)
- Single downloader → Douyin: fetches playback source (evidence: `README.md`)
- User / Codex → Transcript preparation: requests transcript (evidence: `README.md`)
- Transcript preparation → Single downloader: downloads source (evidence: `scripts/transcribe_douyin.py`)
- Transcript preparation → Local ASR: runs recognition (evidence: `scripts/transcribe_douyin.py`)
- Transcript preparation → Corrected Markdown / SRT: prepares draft for correction (evidence: `scripts/transcribe_douyin.py`)
- User / Codex → Creator workflow runner: requests creator archive (evidence: `README.md`)
- Creator workflow runner → Public catalog collector: collects public catalog
- Public catalog collector → Creator catalog: saves catalog (evidence: `README.md`)
- Creator workflow runner → Batch downloader: downloads works
- Batch downloader → Douyin: retrieves media (evidence: `README.md`)
- Batch downloader → Local media library: stores original media (evidence: `README.md`)
- Creator workflow runner → Official detail recovery: recovers missing details
- Creator workflow runner → Cover and caption metadata: collects captions and cover text
- Creator catalog → Cover and caption metadata: provides catalog input (evidence: `scripts/collect_cover_metadata.py`)
- Creator workflow runner → Creator metrics: generates metrics
- Creator workflow runner → Transcript export: exports transcripts
- Local media library → Rewrite batch preparation: supplies existing library (evidence: `README.md`)
- User / Codex → Rewrite batch preparation: requests batch rewrite (evidence: `README.md`)
- Rewrite batch preparation → Codex draft rewriting: prepares writing shards (evidence: `README.md`)
- Codex draft rewriting → Speech scripts and indexes: writes scripts and indexes (evidence: `README.md`)
- Dedicated browser launcher → Browser DNS proxy: starts when needed (evidence: `scripts/launch_browser_collector.py`)
- Dedicated browser launcher → Public catalog collector: supports browser collection
