Download Douyin (TikTok China) videos to local disk without needing yt-dlp, cookies, or login.
Execute all steps in order.
If the URL is a short link (v.douyin.com/xxx), resolve it first:
curl -sI "https://v.douyin.com/<ID>/" | grep -i location
Extract the full URL from the location: header. The numeric ID in /video/ is the video_id_str (e.g. 7634389140783615232).
Fetch the mobile Douyin page and extract the internal video_id:
curl -sL "https://www.iesdouyin.com/share/video/<video_id_str>/" \
-H "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15" \
-H "Referer: https://www.douyin.com/" \
-o /tmp/dy_page.html
Extract video_id from the HTML:
grep -o 'video_id[^"]*"[^"]*"' /tmp/dy_page.html
This returns something like video_id=v0d00fg10000d7pc7dvog65j2bpvg940. The part after = is the internal_video_id.
Construct the snssdk play URL and download:
curl -L "https://aweme.snssdk.com/aweme/v1/playwm/?video_id=<internal_video_id>&ratio=720p&line=0" \
-H "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15" \
-H "Referer: https://www.douyin.com/" \
-o ~/Downloads/<output_filename>.mp4
playwm = 720p with Douyin watermarkplaywm with play and append &watermark=0 (may need additional signature handling)~/Downloads/ using the video title as filenameCheck file size and format:
ls -lh ~/Downloads/<output_filename>.mp4 && file ~/Downloads/<output_filename>.mp4
iesdouyin.com) works without authenticationcurl -L (follow redirects) and verify the video_id is correctplaywm always includes Douyin watermark; getting no-watermark requires the play endpoint with signed parameters (complex, not covered here)v.douyin.com/xxx short links and www.iesdouyin.com/share/video// direct linksSee references/douyin_api.md for detailed endpoint documentation and troubleshooting.
共 1 个版本