Files
Obsidian/MyBestNanobot/yt-dlp 常用命令.md
coco 8b94d76799 a
2026-07-21 13:57:15 +08:00

58 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
yt-dlp 常用命令:
## **📥 基础下载**
```bash
# 下载单个视频
yt-dlp "https://www.bilibili.com/video/BV1xx411c7mD"
# 指定质量(1080p)
yt-dlp -f "bestvideo[height<=1080]+bestaudio" "URL"
# 只下载音频(MP3)
yt-dlp -x --audio-format mp3 "URL"
```
## **ℹ️ 提取信息(不下载)**
```bash
# 获取视频元数据(JSON格式)
yt-dlp --dump-json "URL" | jq .
# 获取标题、播放量、描述等
yt-dlp --print "%(title)s\n%(view_count)s\n%(description)s" "URL"
# 列播放列表中的所有视频
yt-dlp --flat-playlist --print "%(title)s: %(webpage_url)s" "PLAYLIST_URL"
```
## **📜 下载字幕/弹幕**
```bash
# 下载B站弹幕(XML转ASS)
yt-dlp --list-subs "URL" # 查看可用字幕
yt-dlp --write-subs --write-auto-subs "URL" # 下载字幕
# B站弹幕
yt-dlp --write-comments "URL" # 弹幕作为评论
```
## **👤 下载UP主所有视频**
```bash
# 下载整个空间(谨慎使用!)
yt-dlp "https://space.bilibili.com/123456789"
# 只列出来不下载
yt-dlp --flat-playlist --print "%(title)s" "https://space.bilibili.com/123456789"
```
## **🔧 实用选项**
```bash
yt-dlp -o "%(title)s.%(ext)s" "URL" # 自定义文件名
yt-dlp --proxy "http://127.0.0.1:7890" "URL" # 使用代理
yt-dlp -F "URL" # 列出所有可用格式
```
需要具体测试哪个命令?🐈