video-dl

TotalClaw 作者 totalclaw

使用 yt-dlp 从 YouTube、Reddit、Twitter/X、TikTok、Instagram 和 1000 多个其他网站下载视频。当用户提供视频链接并想要下载时使用。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~dimitryvin-video-dl
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~dimitryvin-video-dl/file -o dimitryvin-video-dl.md
# Video Downloader

Download videos from almost any website using yt-dlp.

## Supported Sites

YouTube, Reddit, Twitter/X, TikTok, Instagram, Vimeo, Facebook, Twitch, and 1000+ others. Full list: https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md

## Usage

### Quick Download (best quality)

```bash
{baseDir}/scripts/download.sh "URL"
```

Downloads to `~/Downloads/videos/` with best quality.

### With Options

```bash
{baseDir}/scripts/download.sh "URL" [OPTIONS]
```

**Common options:**
- `--audio-only` - Extract audio only (mp3)
- `--720p` - Limit to 720p max
- `--1080p` - Limit to 1080p max  
- `--output DIR` - Custom output directory
- `--filename NAME` - Custom filename (without extension)

### Examples

```bash
# Download YouTube video (best quality)
{baseDir}/scripts/download.sh "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

# Download Reddit video
{baseDir}/scripts/download.sh "https://www.reddit.com/r/videos/comments/abc123/cool_video/"

# Extract audio only
{baseDir}/scripts/download.sh "https://www.youtube.com/watch?v=dQw4w9WgXcQ" --audio-only

# Download to specific folder
{baseDir}/scripts/download.sh "URL" --output ~/Videos/projects

# Custom filename
{baseDir}/scripts/download.sh "URL" --filename "my-video"
```

## Output

- Default location: `~/Downloads/videos/`
- Filename format: `{title}-{id}.{ext}`
- Returns full path to downloaded file on success

## Notes

- Reddit videos require merging video+audio (handled automatically)
- Age-restricted YouTube videos may require cookies (not currently configured)
- Very long videos may take time; script shows progress
- If download fails, check if the site is supported or if the video is private/deleted

## Sending to Telegram

Large videos need compression for Telegram's 16MB limit. For long videos:

1. Download the video normally
2. Run compression in background:
   ```bash
   nohup {baseDir}/scripts/compress-and-send.sh "/path/to/video.mp4" "CHAT_ID" > /tmp/compress.log 2>&1 &
   ```
3. Check back after estimated time (duration ÷ 4)
4. Send the resulting `-telegram.mp4` file

This avoids spamming the chat with progress updates.

## Direct yt-dlp Access

For advanced usage, yt-dlp is available at `~/.local/bin/yt-dlp` (updated) or `/usr/bin/yt-dlp`. See `yt-dlp --help` for all options.

---

## 中文说明

# Video Downloader

使用 yt-dlp 从几乎任何网站下载视频。

## 支持的网站

YouTube、Reddit、Twitter/X、TikTok、Instagram、Vimeo、Facebook、Twitch 以及 1000 多个其他网站。完整列表:https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md

## 用法

### 快速下载(最佳质量)

```bash
{baseDir}/scripts/download.sh "URL"
```

以最佳质量下载到 `~/Downloads/videos/`。

### 带选项

```bash
{baseDir}/scripts/download.sh "URL" [OPTIONS]
```

**常用选项:**
- `--audio-only` - 仅提取音频(mp3)
- `--720p` - 限制为最高 720p
- `--1080p` - 限制为最高 1080p  
- `--output DIR` - 自定义输出目录
- `--filename NAME` - 自定义文件名(不含扩展名)

### 示例

```bash
# Download YouTube video (best quality)
{baseDir}/scripts/download.sh "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

# Download Reddit video
{baseDir}/scripts/download.sh "https://www.reddit.com/r/videos/comments/abc123/cool_video/"

# Extract audio only
{baseDir}/scripts/download.sh "https://www.youtube.com/watch?v=dQw4w9WgXcQ" --audio-only

# Download to specific folder
{baseDir}/scripts/download.sh "URL" --output ~/Videos/projects

# Custom filename
{baseDir}/scripts/download.sh "URL" --filename "my-video"
```

## 输出

- 默认位置:`~/Downloads/videos/`
- 文件名格式:`{title}-{id}.{ext}`
- 成功时返回已下载文件的完整路径

## 注意事项

- Reddit 视频需要合并视频+音频(自动处理)
- 受年龄限制的 YouTube 视频可能需要 cookies(当前未配置)
- 非常长的视频可能需要较长时间;脚本会显示进度
- 如果下载失败,请检查该网站是否受支持,或视频是否为私有/已删除

## 发送到 Telegram

大视频需要压缩以符合 Telegram 的 16MB 限制。对于长视频:

1. 正常下载视频
2. 在后台运行压缩:
   ```bash
   nohup {baseDir}/scripts/compress-and-send.sh "/path/to/video.mp4" "CHAT_ID" > /tmp/compress.log 2>&1 &
   ```
3. 在预估时间后回来查看(时长 ÷ 4)
4. 发送生成的 `-telegram.mp4` 文件

这样可以避免用进度更新刷屏聊天。

## 直接访问 yt-dlp

如需高级用法,yt-dlp 位于 `~/.local/bin/yt-dlp`(已更新)或 `/usr/bin/yt-dlp`。所有选项请参见 `yt-dlp --help`。