m3u8-downloader
Download m3u8/mp4 video and mp3/music, support 抖音、皮皮虾、微博 sharing links. Multi-thread download, WebUI, batch and Node API.
Example:
使用 m3u8-media-downloader 下载抖音视频/获取该视频详情:https://v.douyin.com/CW1iv0GeSJM/
Main capabilities
- - m3u8/HLS & mp4 — download and merge to mp4 (ffmpeg required for ts→mp4)
- Music — mp3/m4a from m3u8/stream sources
- 抖音/皮皮虾/微博 — parse or download sharing links
CLI
CODEBLOCK0
Key options
| Option | Description |
|---|
| INLINECODE0 | Output filename |
| INLINECODE1 |
Download threads (default: 4) |
|
-S, --save-dir <dir> | Save directory |
|
-T, --type <type> |
m3u8 (default) \|
parser \|
web |
|
-H, --headers <json> | Custom request headers |
|
--ffmpeg-path <path> | ffmpeg path (for mp4 conversion) |
Quick examples
CODEBLOCK1
WebUI
CODEBLOCK2
Open http://localhost:6600 to manage tasks in browser.
Security Considerations
⚠️ Important Security Notice
- - Version Pinning: This skill uses pinned version
@1.9.0 to prevent execution of different code on each run - Code Review: Inspect the package via
npm view @lzwme/m3u8-dl@1.9.0 or GitHub before execution - Sandbox Environment: Run download tasks in an isolated environment with restricted filesystem permissions
- ffmpeg Installation: Ensure ffmpeg is installed from official or trusted sources only
- Sensitive Variables:
DS_SECRET is sensitive - configure carefully to protect WebUI access - Legal Compliance: Ensure downloads comply with local laws and source site terms of service
Node API
CODEBLOCK3
Scenario guide
| Scenario | CLI | Node API |
|---|
| m3u8/mp4 URL | INLINECODE12 | INLINECODE13 |
| 抖音/皮皮虾/微博 |
--type parser or
info <url> |
VideoParser.parse() |
| Web page with m3u8 |
--type web |
getM3u8Urls() |
| Batch download |
"name\|url" or file |
m3u8BatchDownload() |
| mp4 conversion | Requires ffmpeg | Set
ffmpegPath |
LINKS
- - source: https://github.com/lzwme/m3u8-dl/tree/main/packages/ai-agent/skills/m3u8-media-downloader
m3u8-downloader
下载 m3u8/mp4 视频和 mp3/音乐,支持抖音、皮皮虾、微博分享链接。多线程下载、WebUI、批量下载和 Node API。
示例:
使用 m3u8-media-downloader 下载抖音视频/获取该视频详情:https://v.douyin.com/CW1iv0GeSJM/
主要功能
- - m3u8/HLS & mp4 — 下载并合并为 mp4(ts→mp4 需要 ffmpeg)
- 音乐 — 从 m3u8/流媒体源下载 mp3/m4a
- 抖音/皮皮虾/微博 — 解析或下载分享链接
CLI
bash
推荐方式:固定版本执行
m3u8dl
[options]
m3u8dl info # 解析视频信息
m3u8dl server # 启动 WebUI (http://localhost:6600)
关键选项
| 选项 | 描述 |
|---|
| -f, --filename <name> | 输出文件名 |
| -n, --thread-num <n> |
下载线程数(默认:4) |
| -S, --save-dir | 保存目录 |
| -T, --type | m3u8(默认)\| parser \| web |
| -H, --headers | 自定义请求头 |
| --ffmpeg-path | ffmpeg 路径(用于 mp4 转换) |
快速示例
bash
基本下载
m3u8dl https://example.com/video.m3u8 -f 我的视频 -S ./downloads
抖音/皮皮虾/微博分享链接
解析并下载视频
m3u8dl https://v.douyin.com/xxxxx/ --type parser
解析并打印信息
m3u8dl info https://h5.pipix.com/xxxxx
带名称:名称|url
m3u8dl 第1集|https://example.com/ep1.m3u8
批量下载:文件每行一个文件名$url
m3u8dl series-list.txt -f 系列名称
从网页提取 m3u8
m3u8dl https://example.com/play/123 --type web
WebUI
bash
m3u8dl server [-P <端口>] [-t <令牌>]
可选环境变量自定义:DSPORT, DSSECRET, DSSAVEDIR, DSCACHEDIR, DSFFMPEGPATH
打开 http://localhost:6600 在浏览器中管理任务。
安全注意事项
⚠️ 重要安全提示
- - 版本锁定:本技能使用锁定版本 @1.9.0,防止每次运行时执行不同代码
- 代码审查:通过 npm view @lzwme/m3u8-dl@1.9.0 或 GitHub 检查包内容后再执行
- 沙箱环境:在具有受限文件系统权限的隔离环境中运行下载任务
- ffmpeg 安装:确保仅从官方或可信来源安装 ffmpeg
- 敏感变量:DSSECRET 为敏感变量 - 请谨慎配置以保护 WebUI 访问
- 法律合规:确保下载行为符合当地法律和源网站服务条款
Node API
ts
import { m3u8Download, VideoParser, m3u8BatchDownload } from @lzwme/m3u8-dl;
// 下载 m3u8/mp4
await m3u8Download(url, { filename: video, saveDir: ./downloads });
// 解析抖音/皮皮虾/微博
const parser = new VideoParser();
const info = await parser.parse(https://v.douyin.com/xxxxx/);
await parser.download(info, { saveDir: ./downloads });
// 批量下载
await m3u8BatchDownload([name1$url1, name2$url2], { saveDir: ./downloads });
场景指南
| 场景 | CLI | Node API |
|---|
| m3u8/mp4 URL | m3u8dl <url> | m3u8Download(url) |
| 抖音/皮皮虾/微博 |
--type parser 或 info | VideoParser.parse() |
| 包含 m3u8 的网页 | --type web | getM3u8Urls() |
| 批量下载 | 名称\|url 或文件 | m3u8BatchDownload() |
| mp4 转换 | 需要 ffmpeg | 设置 ffmpegPath |
链接
- - 源码:https://github.com/lzwme/m3u8-dl/tree/main/packages/ai-agent/skills/m3u8-media-downloader