Install
openclaw skills install downloader-tiktok-videosAutomatically downloads the latest video (or the N most recent) from a public TikTok account using yt-dlp. Use this skill whenever the user mentions TikTok,...
openclaw skills install downloader-tiktok-videosDownloader TikTok Videos downloads the latest video (or multiple videos) from a public TikTok account using yt-dlp. Read this documentation fully before writing any code or running commands.
This skill requires yt-dlp (and optionally ffmpeg for audio/video merging).
⚠️ The commands below modify your host environment (install packages system-wide). Run them only if yt-dlp is not already installed and you are comfortable doing so.
pip install -U yt-dlp --break-system-packages # Linux system Python
# or
pip install -U yt-dlp # virtualenv / macOS
yt-dlp --version # verify install
This skill supports four operation types. Determine which one(s) the user needs:
When to use: User provides a @username or profile URL
Steps:
@ if present)https://www.tiktok.com/@{username}--playlist-items 1 --no-download)Command:
yt-dlp \
--playlist-items 1 \
--format "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" \
--merge-output-format mp4 \
--output "./%(uploader_id)s_%(upload_date)s_%(id)s.%(ext)s" \
"https://www.tiktok.com/@{username}"
Verify the result:
ls -lh ./*.mp4
When to use: User wants multiple videos
Steps:
--playlist-items 1-N--download-archive to avoid duplicatesCommand:
yt-dlp \
--playlist-items 1-{N} \
--format "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" \
--merge-output-format mp4 \
--download-archive ./tiktok_archive.txt \
--output "./%(uploader_id)s/%(upload_date)s_%(id)s.%(ext)s" \
"https://www.tiktok.com/@{username}"
When to use: User wants video info without downloading
Read: references/metadata.md for all available fields and the full command
Quick command:
yt-dlp \
--playlist-items 1 \
--skip-download \
--write-info-json \
--print "%(uploader_id)s | %(upload_date)s | %(duration)ss | %(view_count)s views | %(title)s" \
"https://www.tiktok.com/@{username}"
When to use: User provides a direct video URL
Command:
yt-dlp \
--format "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" \
--merge-output-format mp4 \
--output "./%(uploader_id)s_%(id)s.%(ext)s" \
"{video_url}"
| Error | Cause | Fix |
|---|---|---|
HTTP Error 403 | TikTok rate limiting | Add --sleep-interval 3 --max-sleep-interval 6 |
Unable to extract | Outdated yt-dlp | pip install -U yt-dlp --break-system-packages |
Private account | Private account | Use --cookies-from-browser chrome if logged in ⚠️ exports session cookies — keep them private |
No video formats | Geo-restriction | Add --geo-bypass |
Sign in required | Restricted content | Provide cookies via --cookies cookies.txt ⚠️ treat this file like a password |
Merge requires ffmpeg | ffmpeg missing | apt-get install ffmpeg -y |
⚠️ Cookie security note: Browser cookies exported via
--cookies-from-browserorcookies.txtcontain active session tokens. Never share these files, commit them to version control, or pass them to untrusted scripts. Delete them after use if no longer needed.
# Accepts all these formats:
# @myaccount → myaccount
# myaccount → myaccount
# https://www.tiktok.com/@myaccount → myaccount
def normalize(input_str):
if "tiktok.com/@" in input_str:
return input_str.split("tiktok.com/@")[-1].split("/")[0]
return input_str.lstrip("@").strip()
Load these references as needed:
references/metadata.md
references/advanced.md
KBLICENSE.txt
Quick download:
Bulk download:
Metadata:
Direct URL: