## 可复用场景 / Reusable scenario 抖音视频无水印下载(H5 header 两段式路线):短链解析 → 两段式请求 iesdouyin 分享页取得 ttwid 并提取 videoInfoRes.play_addr → playwm 改 play 去水印 → 下载 → ffprobe 校验。免登录、免浏览器渲染、不读取用户浏览器凭据。适用于 v.douyin.com 短链、iesdouyin 分享链接或纯视频 ID 的下载/保存/去水印需求。 Download Douyin videos without watermark over the H5-header two-pass route (short-link resolve → ttwid via two-pass share-page fetch → videoInfoRes play_addr extraction → playwm→play → download → ffprobe verify). No login, no browser rendering, no user-browser credential access. ## 来源与许可 / Provenance & license - 内容为本条目原创(含 scripts/download_douyin.py,纯 Python 标准库),方法于 2026-11-17 在视频 7708667389918858496 上端到端实测通过(1280x720 / 169.18s / 15MB)。 - 许可 MIT;redistribution: allowed;stewardship: community;maintainer: yi-ge。 - 内容不含凭据、不含临时 ref;合规边界(仅下载有权保存内容)已写入正文。 ## 兼容性影响 / Compatibility - 本地技能(SKILL.md + SKILL.zh-CN.md + scripts/),无需新工具或连接;Python 3 标准库 + 可选 ffprobe 校验。 - 未登记 builtin-skills.json(按需安装即可);manifest.stats.totalSkills 149→150。 - source_hash 已按 translate.py 算法回填,en-US 译文 translated_by: ai(由 AI 译自 zh-CN 源文,已人工复核事实一致性)。 ## 已执行校验 / Checks run - `uv run scripts/i18n/validate-i18n.py skills/douyin-video-download` → 0 error(s) - `uv run scripts/catalog/validate_catalog_metadata.py --require-complete` → 0 error(s)(publishableSkills=150) - `uv run scripts/i18n/translate.py --check skills/douyin-video-download` → up-to-date (hash match) - 脚本端到端实测:ffprobe 校验通过,与页面 duration 一致 Co-authored-by: mashagua <993498039@qq.com>
7.5 KiB
name, description, license, version, type, risk_level, status, disable-model-invocation, tags, metadata, market
| name | description | license | version | type | risk_level | status | disable-model-invocation | tags | metadata | market | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| douyin-video-download | Download Douyin (抖音) videos without watermark over the H5-header route: resolve the share short link, obtain the ttwid device cookie via a two-pass request to the iesdouyin share page, extract the play address from the embedded videoInfoRes JSON, swap playwm for play to drop the watermark, download and verify with ffprobe. No login, no browser rendering, no cookie harvesting from user browsers. Use when the user asks to download, save, or de-watermark a Douyin video, or when a message contains a v.douyin.com short link, an iesdouyin share link, or a bare video ID. Trigger words: 下载抖音, 抖音无水印, 保存抖音视频, 解析抖音链接, 抖音视频下载. | MIT | 1.0.0 | procedural | low | enabled | true |
|
|
|
douyin-video-download Skill
L0: One-line Summary
Download Douyin videos without watermark via the mobile H5-header route and verify with ffprobe — no login required.
L1: Overview and Use Cases
Capability
Run the full chain on a Douyin short link / share link / video ID: resolve the
short link, make a two-pass request to the iesdouyin share page to obtain the
ttwid cookie and extract videoInfoRes.play_addr, swap playwm for play to
drop the watermark, download, and verify with ffprobe. The bundled
scripts/download_douyin.py does all of this in one command (stdlib only).
Use Cases
The user provides a v.douyin.com short link, an iesdouyin share link, or a bare video ID and asks to download, save, or de-watermark it; or a previous download attempt failed and needs a reliable path.
Core Value
No user-browser credentials, no login bridge, no browser rendering — pure HTTP. Works even for videos whose desktop web API is blocked by msToken/Argus signing (verified 2026-11).
L2: Detailed Specification
Quick start (recommended)
python3 scripts/download_douyin.py "https://v.douyin.com/<short_id>/" -o out_dir/
python3 scripts/download_douyin.py 7708667389918858496 -o out_dir/
The script resolves the short link, obtains ttwid, extracts the play address,
swaps playwm→play, downloads, and runs ffprobe verification. Output:
<video_id>.mp4 plus metadata. Python standard library only.
Manual steps (when the script is unavailable)
-
Resolve the short link:
curl -sIL -A "$H5UA" "https://v.douyin.com/<short_id>/"and takehttps://www.iesdouyin.com/share/video/<video_id>/?...&share_sign=...from the 302 Location header. -
Prepare H5UA: an iPhone Safari UA, e.g.
Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1; requests must also carry browser-styleAccept/Accept-Languageheaders. -
Two-pass fetch of videoInfoRes: request
https://www.iesdouyin.com/share/video/<video_id>/. The first response only sets attwiddevice-session cookie on the.iesdouyin.comdomain (not a login credential); re-request with that cookie and the response embedsvideoInfoResatvideoInfoRes.item_list[0].video.play_addr.url_list[0], e.g.https://aweme.snssdk.com/aweme/v1/playwm/?video_id=<vid>&ratio=720p&line=0. Extraction snippet:block = html[html.find('"videoInfoRes":{'):] m = re.search(r'"play_addr":\{"uri":"[^"]*","url_list":(\[.*?\])', block) url = json.loads(m.group(1).replace('\\u002F', '/'))[0] -
Watermark-free download: replace
playwmwithplayin the URL and download withcurl -sL, again with the H5 UA + Referer.url_listmay hold several addresses — try them in order; theratiotier comes from the share page. -
Verify: ffprobe for container/duration/resolution; compare with the page
durationfield (unit may be milliseconds — trust ffprobe).
Failure memo (verified 2026-11 — do not retry these)
| Path | Symptom |
|---|---|
| Desktop web API (/aweme/v1/web/aweme/detail) | Blocked by ArgusSecurityPlugin Uifid Not Found (msToken signing required) |
| yt-dlp 2026.10.26 | Fresh cookies needed (msToken requires JS) |
| Single share-page request (no prior ttwid) | Only Set-Cookie returned; no videoInfoRes |
| Requests without browser-style Accept headers | Slimmed response without videoInfoRes |
| Jina Reader anonymous | IP-reputation rate limit 401 |
| Rendering the Douyin page in a browser | Heavy page — quota kills / navigation timeouts |
Error handling
页面无 videoInfoRes(no videoInfoRes): confirm the two-pass request ran (second request carries ttwid) and headers are complete.- Cannot resolve video_id: the short link may have expired — ask the user to re-share, or use the bare numeric ID directly.
- Downloaded body < 10KB: likely an error page — try the next
url_listentry. - CDN rejects: the download request must also carry the H5 UA + Referer.
Compliance boundary
Only download content the user is entitled to keep (their own or authorized material); respect platform terms and copyright; no bulk scraping or infringing redistribution. Never read user-browser cookies or inject login credentials.