twitter-downloader
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseX / Twitter Video Downloader (twmd)
X / Twitter 视频下载器(twmd)
Download videos from individual X (Twitter) posts using , an API-less Go-based downloader.
twmd使用这款基于Go语言开发、无需API的下载工具,从单个X(原Twitter)帖子下载视频。
twmdWhen to Use
使用场景
Use this skill when users:
- Provide an X/Twitter post URL and want to download its video
- Mention "下载推文视频", "download Twitter video", "save X video", "下载 X 视频"
- Share a link like or
https://x.com/username/status/123456https://twitter.com/username/status/123456
当用户出现以下情况时,可使用此技能:
- 提供X/Twitter帖子URL并希望下载其中的视频
- 提及“下载推文视频”“download Twitter video”“save X video”“下载 X 视频”等内容
- 分享类似或
https://x.com/username/status/123456的链接https://twitter.com/username/status/123456
Usage
使用方法
Basic Syntax
基本语法
bash
python scripts/download_tweet.py "TWEET_URL" [OPTIONS]bash
python scripts/download_tweet.py "TWEET_URL" [OPTIONS]Common Scenarios
常见场景
Download video from a tweet:
bash
python scripts/download_tweet.py "https://x.com/username/status/1234567890"Specify output directory:
bash
python scripts/download_tweet.py "https://x.com/username/status/1234567890" -o ~/Downloads/twitterDownload in specific quality:
bash
python scripts/download_tweet.py "https://x.com/username/status/1234567890" -q 720Print video URL without downloading:
bash
python scripts/download_tweet.py "https://x.com/username/status/1234567890" --url-only下载推文视频:
bash
python scripts/download_tweet.py "https://x.com/username/status/1234567890"指定输出目录:
bash
python scripts/download_tweet.py "https://x.com/username/status/1234567890" -o ~/Downloads/twitter指定画质下载:
bash
python scripts/download_tweet.py "https://x.com/username/status/1234567890" -q 720仅打印视频URL不下载:
bash
python scripts/download_tweet.py "https://x.com/username/status/1234567890" --url-onlyArguments
参数说明
| Argument | Description | Default |
|---|---|---|
| X/Twitter post URL (required) | - |
| Output directory | Current directory |
| Video quality: | |
| Print video direct URL without downloading | False |
| Path to cookies file (for private/restricted content) | None |
| 参数 | 描述 | 默认值 |
|---|---|---|
| X/Twitter帖子URL(必填) | - |
| 输出目录 | 当前目录 |
| 视频画质选项: | |
| 仅打印视频直链,不执行下载 | False |
| Cookies文件路径(用于访问私密/受限内容) | None |
Dependencies
依赖安装
bash
pip install yt-dlpNo additional setup needed. handles public X/Twitter posts without cookies or API keys.
yt-dlpbash
pip install yt-dlp无需额外配置。可直接处理公开的X/Twitter帖子,无需Cookies或API密钥。
yt-dlpOutput Structure
输出结构
OutputDir/
└── <tweet_id>.mp4 # Downloaded video filetwmdOutputDir/
└── <tweet_id>.mp4 # 下载后的视频文件twmdAuthentication (Optional)
身份验证(可选)
For private accounts or login-gated content, export cookies from your browser:
- Install a browser extension like "Get cookies.txt LOCALLY"
- Log in to X, then export cookies for as a Netscape-format
x.comfile.txt - Pass the file with :
--cookies
bash
python scripts/download_tweet.py "URL" --cookies ~/x-cookies.txt如需下载私人账号或需登录才能查看的内容,请从浏览器导出Cookies:
- 安装浏览器扩展,如“Get cookies.txt LOCALLY”
- 登录X账号,导出的Netscape格式
x.com文件.txt - 通过参数传入该文件:
--cookies
bash
python scripts/download_tweet.py "URL" --cookies ~/x-cookies.txtClaude Integration
与Claude集成
When user provides an X/Twitter post URL and wants to download its video:
-
Check if yt-dlp is installed:bash
yt-dlp --version -
Install if missing:bash
pip install yt-dlp -
Execute download:bash
python twitter-downloader/scripts/download_tweet.py "TWEET_URL" -o ./output -
Report the downloaded file to the user with its path and size.
当用户提供X/Twitter帖子URL并希望下载视频时:
-
检查yt-dlp是否已安装:bash
yt-dlp --version -
若未安装则执行安装:bash
pip install yt-dlp -
执行下载命令:bash
python twitter-downloader/scripts/download_tweet.py "TWEET_URL" -o ./output -
向用户反馈下载结果,包括文件路径和大小。
Common Issues
常见问题
Q: Download fails with "Unable to extract" error?
A: Update yt-dlp first: — X/Twitter frequently changes its API.
pip install -U yt-dlpQ: The tweet has no video?
A: Try to check what media yt-dlp can find. Image-only tweets will not yield a video URL.
--url-onlyQ: Need to download from a private account?
A: Export browser cookies (see Authentication section above) and pass with .
--cookiesQ: Why not just use youtube-downloader for Twitter URLs?
A: You can — yt-dlp handles Twitter URLs too. This skill provides a Twitter-focused interface with cleaner prompts and no unneeded options (playlists, subtitles, etc.).
问:下载时出现“Unable to extract”错误怎么办?
答:先更新yt-dlp:——X/Twitter经常会更改其API。
pip install -U yt-dlp问:推文里没有视频?
答:尝试使用参数查看yt-dlp能识别到哪些媒体内容。仅含图片的推文无法获取视频URL。
--url-only问:需要从私人账号下载内容?
答:按照上述“身份验证”部分的步骤导出浏览器Cookies,并通过参数传入。
--cookies问:为什么不直接用youtube-downloader处理Twitter链接?
答:其实也可以——yt-dlp本身也支持Twitter链接。本技能提供了针对Twitter的专用界面,提示更简洁,且没有多余选项(如播放列表、字幕等)。