| name | dy-tt-yt-download |
| description | Download Douyin, TikTok, YouTube, and Bilibili videos by using local Chrome DevTools Protocol inspection, platform web JSON/API extraction, and JS-managed media downloads, then save the MP4 plus a manifest for downstream analysis. |
Douyin / TikTok / YouTube / Bilibili Video Download
Goal
Download a Douyin, TikTok, YouTube, or Bilibili video to a local MP4 file for reference-video analysis, template extraction, content review, or workflow reproduction.
Use this skill when the user provides a Douyin video URL, Douyin short share URL, Douyin user page URL with modal_id, TikTok video URL, YouTube URL, or Bilibili URL, and asks to download, fetch, save, inspect, or prepare the video locally.
Inputs
Required:
url: Douyin video URL, Douyin short share URL, Douyin user page URL with modal_id, TikTok video URL, YouTube URL, or Bilibili URL.
Optional:
outputDir: default douyin-output/downloads/<run-id>/.
filename: optional MP4 filename.
preferNoWatermark: default true; for Douyin, tries replacing playwm with play when the rendered source supports it.
headful: default false; use only for debugging login, captcha, or rendering issues.
chromePath: default /Applications/Google Chrome.app/Contents/MacOS/Google Chrome.
youtubeClient: default android; selects the YouTube Innertube client profile.
youtubeFormat: default 18/best; selects preferred YouTube muxed MP4 itags.
Quick Start
Use {baseDir} as the directory containing this SKILL.md.
node {baseDir}/scripts/cli/douyin-download.js "<video-url>" \
--output-dir "douyin-output/downloads/<run-id>" \
--agent-output
Dry run:
node {baseDir}/scripts/cli/douyin-download.js "<video-url>" \
--output-dir "douyin-output/downloads/<run-id>" \
--dry-run \
--agent-output
Debug with a visible Chrome window:
node {baseDir}/scripts/cli/douyin-download.js "<video-url>" \
--output-dir "douyin-output/downloads/<run-id>" \
--headful
Workflow
- Create a run directory under
douyin-output/downloads/, preferably with a timestamp or short task label.
- Run
node {baseDir}/scripts/cli/douyin-download.js with the user URL.
- If the script succeeds, return:
- clickable local MP4 path;
manifest.json path;
- resolved page URL;
- selected format and whether the selected URL was original or no-watermark candidate.
- If the download fails, inspect
manifest.json and report the exact blocker.
- If blocked by captcha, login, regional access, or anti-bot checks, ask the user for one of:
- a locally downloaded video file;
- permission to rerun with
--headful so they can complete browser checks;
- screenshots or transcript if only template analysis is needed.
Quality Checks
- Confirm the downloaded file exists and is larger than zero bytes.
- Save
manifest.json even on failure so later debugging has the URL, status, and error.
- Do not store cookies, credentials, or browser session exports in this skill or in git-tracked files.
- Do not claim no-watermark success unless
manifest.json shows watermark_mode as play-no-watermark-candidate.
- For TikTok, do not expose extracted Cookie headers in user-facing output or tracked files. The script uses temporary browser cookies only for the immediate media request.
- For YouTube, do not export browser cookies or account state. The script uses the Android Innertube player API and direct muxed MP4 URLs.
- For Bilibili, the script may download separate DASH video/audio segments and merge them with
ffmpeg; verify the final MP4 after muxing.
- Prefer local clickable paths in the final response.
Output
The script returns these stable fields when --agent-output is used:
status: success, dry-run, or failed.
downloaded_file: local MP4 path when downloaded.
manifest: local JSON manifest path.
download_url: rendered video URL used for download.
format_id: selected platform format ID when available.
watermark_mode: original, original-playwm-fallback, or play-no-watermark-candidate.
resolved_page_url: page URL after redirects.
error: failure reason when blocked or failed.
Notes
For Douyin, the script uses rendered-page inspection and optional playwm to play replacement.
For TikTok, the script follows the same broad extraction path as yt-dlp: open the desktop web page, parse __UNIVERSAL_DATA_FOR_REHYDRATION__, SIGI_STATE, or __NEXT_DATA__, collect video.bitrateInfo[].PlayAddr.UrlList, sort playable MP4 candidates, then download with browser-like headers and the temporary TikTok cookies set by the page. The Node downloader is proxy-aware through HTTPS_PROXY, HTTP_PROXY, ALL_PROXY, and NO_PROXY.
For YouTube, the script calls the Android Innertube player endpoint directly from Node, selects direct muxed MP4 formats such as itag 18, and downloads the returned googlevideo.com URL without yt-dlp.
For Bilibili, the script parses window.__INITIAL_STATE__ from the page to get bvid and cid, calls x/player/playurl, downloads the selected DASH video/audio URLs, then uses ffmpeg -c copy to produce the MP4.
Use external platform extractors only as a last-resort fallback when this script is blocked by login, captcha, regional access, or a platform-side extractor change.
The Douyin and TikTok paths launch the local Chrome executable directly and do not require Python Playwright or Puppeteer. The YouTube path has no Python dependency. The Bilibili path requires ffmpeg for DASH audio/video muxing.