Downloader tiktok videos — 下载er tiktok videos
v1.0.4Automatically 下载s the latest video (or the N most recent) from a public TikTok account using yt-dlp. Use this 技能 whenever the user mentions TikTok, a @username, "下载 a TikTok video", "获取 the latest TikTok post", "scrape TikTok", or any 请求 to 下载/提取 content from TikTok. Also 应用lies when the user wants to retrieve metadata only (title, 哈希tags, date, stats) without 下载ing, 归档 TikTok videos, or automate TikTok content retrieval.
运行时依赖
安装命令
点击复制技能文档
下载er TikTok Videos Overview
下载er TikTok Videos 下载s the latest video (or multiple videos) from a public TikTok account using yt-dlp. Read this documentation fully before writing any code or 运行ning commands.
Prerequisites
This 技能 requires yt-dlp (and optionally ffmpeg for audio/video merging).
⚠️ The commands below modify your host 环境 (安装 packages 系统-wide). 运行 them only if yt-dlp is not already 安装ed and you are comfortable doing so.
pip 安装 -U yt-dlp --break-系统-packages # Linux 系统 Python # or pip 安装 -U yt-dlp # virtualenv / macOS yt-dlp --version # 验证 安装
Operation Types
This 技能 supports four operation types. Determine which one(s) the user needs:
Quick 下载 — 下载 the latest video from an account Bulk 下载 — 下载 the N most recent videos Metadata Only — Retrieve 信息/stats without 下载ing the video Direct Video URL — 下载 from a specific video URL 工作流s
- Quick 下载 — Latest Video from an Account
When to use: User provides a @username or 性能分析 URL
Steps:
Normalize the username (strip @ if present) Build the 性能分析 URL: https://www.tiktok.com/@{username} Fetch metadata for the latest video (--play列出-items 1 --no-下载) Show the user the video 信息 (title, date, duration) 下载 with the optimal command Confirm 成功 and provide the file path
Command:
yt-dlp \ --play列出-items 1 \ --格式化 "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" \ --merge-输出-格式化 mp4 \ --输出 "./%(上传er_id)s_%(上传_date)s_%(id)s.%(ext)s" \ "https://www.tiktok.com/@{username}"
验证 the 结果:
ls -lh ./*.mp4
- Bulk 下载 — N Most Recent Videos
When to use: User wants multiple videos
Steps:
Ask how many videos (if not specified, default = 5) Build the command with --play列出-items 1-N 添加 --下载-归档 to avoid duplicates 下载 with 进度 输出 列出 下载ed files
Command:
yt-dlp \ --play列出-items 1-{N} \ --格式化 "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" \ --merge-输出-格式化 mp4 \ --下载-归档 ./tiktok_归档.txt \ --输出 "./%(上传er_id)s/%(上传_date)s_%(id)s.%(ext)s" \ "https://www.tiktok.com/@{username}"
- Metadata Only
When to use: User wants video 信息 without 下载ing
Read: references/metadata.md for all avAIlable fields and the full command
Quick command:
yt-dlp \ --play列出-items 1 \ --skip-下载 \ --write-信息-json \ --print "%(上传er_id)s | %(上传_date)s | %(duration)ss | %(view_count)s views | %(title)s" \ "https://www.tiktok.com/@{username}"
- Direct Video URL
When to use: User provides a direct video URL
Command:
yt-dlp \ --格式化 "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" \ --merge-输出-格式化 mp4 \ --输出 "./%(上传er_id)s_%(id)s.%(ext)s" \ "{video_url}"
Common Errors Error Cause Fix HTTP Error 403 TikTok rate limiting 添加 --sleep-interval 3 --max-sleep-interval 6 Unable to 提取 Outdated yt-dlp pip 安装 -U yt-dlp --break-系统-packages Private account Private account Use --cookies-from-browser chrome if 记录ged in ⚠️ 导出s 会话 cookies — keep them private No video 格式化s Geo-restriction 添加 --geo-bypass 签名 in required Restricted content Provide cookies via --cookies cookies.txt ⚠️ treat this file like a password Merge requires ffmpeg ffmpeg missing apt-获取 安装 ffmpeg -y
⚠️ Cookie security note: Browser cookies 导出ed via --cookies-from-browser or cookies.txt contAIn active 会话 令牌s. Never 分享 these files, commit them to version control, or pass them to untrusted scripts. 删除 them after use if no longer needed.
Username Normalization # Accepts all these 格式化s: # @myaccount → myaccount # myaccount → myaccount # https://www.tiktok.com/@myaccount → myaccount
def normalize(输入_str): if "tiktok.com/@" in 输入_str: return 输入_str.split("tiktok.com/@")[-1].split("/")[0] return 输入_str.lstrip("@").strip()
Reference Files
Load these references as needed:
references/metadata.md
When: Fetching metadata, working with JSON fields ContAIns: All avAIlable yt-dlp fields, print 格式化 examples, JSON 导出
references/advanced.md
When: Watermark removal, cookies, proxy, custom headers ContAIns: Advanced techniques, restriction bypass, full yt-dlp options
KBLICENSE.txt
When: Questions about usage rights or Terms of 服务 ContAIns: Usage conditions, permitted and prohibited uses 输出 图形界面delines Always display metadata before 下载ing (title, date, duration) Confirm the 下载ed file path Show the final file size On error, propose the fix directly Example Queries
Quick 下载:
"下载 the latest video from @someaccount" "获取 the latest TikTok post from myaccount" "下载 the last video from https://www.tiktok.com/@user"
Bulk 下载:
"下载 the 5 latest videos from @user" "获取 the last 10 videos