---
name: "m3u8-downloader-yashu"
description: "本技能用于生成一条可直接复制执行的 yt-dlp 命令来下载 m3u8/HLS 视频。激活条件：用户消息须包含以下关键词之一:`下载视频`、`m3u8下载`、`下载m3u8链接`、`用猫抓抓视频`、`视频下载报403`。"
title: m3u8-downloader-yashu
canonical_url: https://skilld.dev/gh/steelan9199/wechat-publisher/m3u8-downloader-yashu
last_updated: 2026-10-07T07:20:50.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install steelan9199/wechat-publisher/m3u8-downloader-yashu`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/m3u8-downloader-yashu`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/steelan9199/wechat-publisher/m3u8-downloader-yashu) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/m3u8-downloader-yashu`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/m3u8-downloader-yashu --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/m3u8-downloader-yashu --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# M3U8 视频下载器（一键命令生成）

## 职责边界（必须遵守）

本 skill 只做两件事：

1. 指导用户用「猫抓」扩展获取 m3u8 链接（用户不会抓时才需要引导）
2. 生成一条可直接复制、由**用户自己在终端执行**的 yt-dlp 命令

**Agent 绝对不要自己执行下载命令。** 原因：Trae 沙盒限制写盘目录 + 反爬请求易被拦截。一律把生成好的命令交给用户跑。

## 第一步：获取 m3u8 链接（猫抓 cat-catch）

当用户只有网页地址、没有 m3u8 链接时，向用户展示以下步骤：

1. 在 Chrome/Edge 安装扩展「**猫抓 cat-catch**」（应用商店搜索即可）
2. 打开目标视频网页，**点击播放视频**
3. 点击浏览器右上角的猫抓图标
4. 在弹出的媒体列表中找到 `.m3u8` 结尾的条目：
   - 优先复制 **`playlist.m3u8`**（主播放列表，会自动选最高画质）
   - 若主链接下载被拒，再换具体画质的子清单，如 `720p/video.m3u8`
5. 右键复制该条目的完整链接

## 第二步：生成一键命令

将下方模板中的三个 `<占位符>` 替换为实际值后，整条输出给用户：

```powershell
D:\software\yt-dlp_win\yt-dlp.exe --impersonate chrome --referer "<来源网页地址>" -N 8 -o "<输出路径>\<文件名>.%(ext)s" "<m3u8链接>"
```

### 固定参数说明（不可删减）

| 参数 | 作用 |
|------|------|
| `--impersonate chrome` | **核心参数**。模拟真实 Chrome 的 TLS 指纹通过 Cloudflare 检测（实测缺失必 403） |
| `--referer "<来源网页>"` | 过防盗链。默认填 `https://missav.live/`，其他站点改为对应视频网页地址 |
| `-N 8` | 8 线程并发下载分片，大幅提速 |
| `-o "<路径>\<文件名>.%(ext)s"` | 输出位置，**每次由用户临时指定** |

环境前提（已验证）：yt-dlp 位于 `D:\software\yt-dlp_win\yt-dlp.exe`，ffmpeg 已在 PATH 中负责合并封装。

## 第三步：报错对照表

| 报错 | 处理方案 |
|------|---------|
| `HTTP Error 403`（Cloudflare anti-bot） | 确认带了 `--impersonate chrome`；仍 403 则换子清单链接（如 `720p/video.m3u8`）重试 |
| 换子清单仍 403 | 追加 `--cookies-from-browser edge`（或 `chrome`），借用真实浏览器的通过凭证 |
| `curl: (56) Connection closed abruptly` | 个别分片网络中断，yt-dlp 会自动重试，无需处理 |
| `ffmpeg not found` | 执行 `winget install ffmpeg` 后重跑同一条命令 |
| 中途断开/失败 | **直接重跑同一条命令**，自动断点续传，已下分片不重复下载 |

## 行为准则

- 用户给了 m3u8 链接 → 直接输出替换好占位符的完整命令
- 用户只给网页地址 → 先展示「第一步」教其用猫抓抓取，拿到链接后再生成命令
- 文件超过 1G 属正常现象，主动告知用户支持断点续传、中途断了重跑即可
- 用户要求时，可额外生成 `.bat` 双击脚本（写入工作区等沙盒允许的位置）
