@lzwme/m3u8-dl 1.6.0-0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.MD +293 -212
- package/README.zh-CN.md +580 -0
- package/cjs/i18n/locales/en.js +1 -1
- package/cjs/i18n/locales/{zh.js → zh-CN.js} +1 -1
- package/cjs/lib/file-download.js +1 -1
- package/cjs/lib/format-options.js +27 -4
- package/cjs/lib/i18n.d.ts +1 -1
- package/cjs/lib/i18n.js +29 -10
- package/cjs/lib/m3u8-download.js +1 -1
- package/cjs/server/download-server.js +3 -2
- package/cjs/types/m3u8.d.ts +2 -2
- package/client/assets/main-ChJ1yjNN.css +1 -0
- package/client/assets/main-DZTEqg-V.js +29 -0
- package/client/index.html +3 -3
- package/client/m3u8-capture.user.js +94 -0
- package/client/play.html +2 -2
- package/package.json +20 -10
- package/client/assets/main-DYJAIw1q.css +0 -1
- package/client/assets/main-XL0wiaDU.js +0 -25
- /package/cjs/i18n/locales/{zh.d.ts → zh-CN.d.ts} +0 -0
package/README.MD
CHANGED
|
@@ -12,319 +12,348 @@
|
|
|
12
12
|
[![GitHub forks][forks-badge]][forks-url]
|
|
13
13
|
[![GitHub stars][stars-badge]][stars-url]
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
> **Language**: [English](README.md) | [中文简体](README.zh-CN.MD)
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
A free, open-source, and powerful m3u8 video batch downloader with multi-threaded downloading, play-while-downloading, WebUI management, video parsing, and more. Supports multiple usage methods including CLI command line, browser, PC client, Docker deployment, and Node.js API calls.
|
|
18
|
+
|
|
19
|
+
## ✨ Features
|
|
20
|
+
|
|
21
|
+
### 🚀 Core Download Features
|
|
22
|
+
|
|
23
|
+
- **Multi-threaded Downloading**: Uses thread pool mode with customizable thread count, significantly improving download speed
|
|
24
|
+
- **Play-While-Downloading Mode**: Supports online playback using downloaded ts cache files without waiting for complete download
|
|
25
|
+
- **Batch Downloading**: Supports batch downloading of multiple m3u8 addresses, supports batch import from text files
|
|
26
|
+
- **Resume from Cache**: Failed downloads retain cache, retries only download failed segments, saving bandwidth and time
|
|
27
|
+
- **AES Encryption Support**: Automatically identifies and decrypts common AES-128 encrypted video streams
|
|
28
|
+
- **Format Conversion**: Automatically merges and converts downloaded ts segments to mp4 format (requires [ffmpeg](https://ffmpeg.org/download.html))
|
|
29
|
+
- **Multi-format Support**: Supports downloading video files in mp4, mkv, and other formats
|
|
30
|
+
- **Segment Filtering**: Supports ignoring video segments in specified time ranges (e.g., skip intro and outro)
|
|
31
|
+
|
|
32
|
+
### 🌐 WebUI Download Management
|
|
33
|
+
|
|
34
|
+
- **Modern Interface**: Modern web interface built with Vue 3 + TypeScript
|
|
35
|
+
- **Real-time Progress**: Real-time display of download progress and status via WebSocket
|
|
36
|
+
- **Task Management**: Supports pausing, resuming, and deleting download tasks, supports batch operations
|
|
37
|
+
- **Download Center**: Centralized management of all download tasks, supports search and filtering
|
|
38
|
+
- **Configuration Management**: Visual configuration of download parameters (thread count, save directory, etc.)
|
|
39
|
+
- **Access Control**: Supports setting access password (token) to protect the service
|
|
18
40
|
|
|
19
|
-
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
### 🎬 Video Parsing Features
|
|
44
|
+
|
|
45
|
+
- **Multi-platform Support**: Supports parsing video sharing links from platforms like Douyin, Weibo, Pipixia, etc.
|
|
46
|
+
- **Watermark-free Download**: Automatically extracts watermark-free video addresses and downloads
|
|
47
|
+
- **Smart Recognition**: Automatically recognizes video platforms and selects appropriate parsers
|
|
20
48
|
|
|
21
|
-
###
|
|
49
|
+
### 🔍 Smart m3u8 Address Extraction
|
|
22
50
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- **缓存续传**:下载失败会保留缓存,重试时只下载失败的片段,节省带宽和时间
|
|
27
|
-
- **AES 加密支持**:自动识别并解密常见的 AES-128 加密视频流
|
|
28
|
-
- **格式转换**:自动将下载的 ts 片段合并转换为 mp4 格式(需安装 [ffmpeg](https://ffmpeg.org/download.html))
|
|
29
|
-
- **多格式支持**:支持下载 mp4、mkv 等格式的视频文件
|
|
30
|
-
- **片段过滤**:支持忽略指定时间段的视频片段(如跳过片头片尾)
|
|
51
|
+
- **Web Page Extraction**: Supports automatic extraction of m3u8 addresses from video playback pages
|
|
52
|
+
- **Deep Search**: Supports multi-level page search, automatically discovers video links
|
|
53
|
+
- **Batch Extraction**: Extract multiple video links at once, supports batch downloading
|
|
31
54
|
|
|
32
|
-
|
|
55
|
+

|
|
33
56
|
|
|
34
|
-
|
|
35
|
-
- **实时进度**:通过 WebSocket 实时显示下载进度和状态
|
|
36
|
-
- **任务管理**:支持暂停、恢复、删除下载任务,支持批量操作
|
|
37
|
-
- **下载中心**:集中管理所有下载任务,支持搜索和筛选
|
|
38
|
-
- **配置管理**:可视化配置下载参数(线程数、保存目录等)
|
|
39
|
-
- **访问控制**:支持设置访问密码(token)保护服务
|
|
57
|
+
### 🎯 Browser Userscript Capture Tool
|
|
40
58
|
|
|
41
|
-
|
|
59
|
+
- **Auto Capture**: Automatically intercepts and captures m3u8 and mp4 video links in web pages
|
|
60
|
+
- **Real-time Monitoring**: Monitors network requests (XMLHttpRequest, fetch, Performance API), automatically discovers video links
|
|
61
|
+
- **Smart Recognition**: Automatically recognizes video types (M3U8/MP4) and extracts video names
|
|
62
|
+
- **One-click Jump**: Supports one-click jump to m3u8-dl WebUI for downloading
|
|
63
|
+
- **Flexible Configuration**: Supports configuring exclusion URL rules to avoid capturing on specific pages
|
|
64
|
+
- **Draggable Panel**: Supports dragging to move panel position, automatically saves position
|
|
65
|
+
- **Link Management**: Supports copying links, clearing list, and other operations
|
|
42
66
|
|
|
43
|
-
-
|
|
44
|
-
- **无水印下载**:自动提取无水印视频地址并下载
|
|
45
|
-
- **智能识别**:自动识别视频平台并选择合适的解析器
|
|
67
|
+
> This is a Tampermonkey/Greasemonkey userscript that can automatically capture video links in browsers, working with m3u8-dl WebUI to provide a seamless download experience.
|
|
46
68
|
|
|
47
|
-
###
|
|
69
|
+
### 📺 Video Search Features
|
|
70
|
+
|
|
71
|
+
- **Collection Site Support**: Supports standard collection site APIs, search and download through command-line interaction
|
|
72
|
+
- **Cache Mechanism**: Automatically caches search history, supports continuing unfinished downloads
|
|
73
|
+
|
|
74
|
+

|
|
48
75
|
|
|
49
|
-
|
|
50
|
-
- **深度搜索**:支持多层级页面搜索,自动发现视频链接
|
|
51
|
-
- **批量提取**:一次提取多个视频链接,支持批量下载
|
|
76
|
+
### ▶️ Video Playback
|
|
52
77
|
|
|
53
|
-
|
|
78
|
+
- **Built-in Player**: Both WebUI and desktop client have built-in lightweight video players, can directly play downloaded or downloading videos online without waiting for completion.
|
|
79
|
+
- **Play-While-Downloading**: Supports automatic splicing of ts cache segments, can play while downloading, achieving "download and watch" experience.
|
|
80
|
+
- **Multi-format Support**: Player supports playback of mainstream video formats like mp4, ts, with drag, speed control, fullscreen, picture-in-picture, and other operations.
|
|
81
|
+
- **History**: Automatically records playback progress, supports resume playback, convenient for long video series watching.
|
|
54
82
|
|
|
55
|
-
-
|
|
56
|
-
- **缓存机制**:自动缓存搜索历史,支持继续未完成的下载
|
|
83
|
+
> No need to rely on third-party players, you can directly watch downloaded content in the browser or client, improving convenience.
|
|
57
84
|
|
|
58
|
-
|
|
85
|
+

|
|
59
86
|
|
|
60
|
-
|
|
61
|
-
- **Node.js API**:提供编程接口,方便集成到其他项目
|
|
62
|
-
- **Web 服务**:支持启动为 Web 服务,通过浏览器管理下载
|
|
63
|
-
- **Docker 部署**:提供 Docker 镜像,一键部署到服务器
|
|
64
|
-
- **Electron 桌面应用**:支持打包为桌面应用,包含内置浏览器功能
|
|
87
|
+
### 💻 Multiple Usage Methods
|
|
65
88
|
|
|
66
|
-
|
|
89
|
+
- **Command Line Tool**: Provides complete CLI commands with various parameter configurations
|
|
90
|
+
- **Node.js API**: Provides programming interface for easy integration into other projects
|
|
91
|
+
- **Web Service**: Supports starting as a web service, manage downloads through browser
|
|
92
|
+
- **Docker Deployment**: Provides Docker image for one-click deployment to server
|
|
93
|
+
- **Electron Desktop App**: Supports packaging as desktop application with built-in browser functionality
|
|
67
94
|
|
|
68
|
-
|
|
69
|
-
- 命令行和 WebUI 均支持语言切换
|
|
95
|
+
### 🌍 Internationalization Support
|
|
70
96
|
|
|
71
|
-
|
|
97
|
+
- Supports Chinese and English multi-language
|
|
98
|
+
- Both command line and WebUI support language switching
|
|
72
99
|
|
|
73
|
-
|
|
100
|
+
## 📦 Installation
|
|
101
|
+
|
|
102
|
+
**Method 1: Global Installation with Node.js**
|
|
103
|
+
|
|
104
|
+
Use as a CLI command-line tool.
|
|
74
105
|
|
|
75
106
|
```bash
|
|
76
107
|
npm i -g @lzwme/m3u8-dl
|
|
77
108
|
m3u8dl -h
|
|
78
109
|
```
|
|
79
110
|
|
|
80
|
-
|
|
111
|
+
Or use `npx` to run directly:
|
|
81
112
|
|
|
82
113
|
```bash
|
|
83
114
|
npx @lzwme/m3u8-dl -h
|
|
84
115
|
```
|
|
85
116
|
|
|
86
|
-
|
|
117
|
+
**Method 2: Desktop Application Download**
|
|
87
118
|
|
|
88
|
-
|
|
119
|
+
Install as a PC client. Easy to use, suitable for most regular users, with built-in browser functionality to automatically extract video addresses. Download the latest version from one of the following addresses:
|
|
89
120
|
|
|
90
121
|
- [https://m3u8-player.lzw.me/download.html](https://m3u8-player.lzw.me/download.html)
|
|
91
122
|
- [https://github.com/lzwme/m3u8-dl/releases](https://github.com/lzwme/m3u8-dl/releases)
|
|
92
123
|
|
|
93
|
-
## 📖
|
|
124
|
+
## 📖 Usage Guide
|
|
94
125
|
|
|
95
|
-
>
|
|
96
|
-
>
|
|
126
|
+
> **Tip**: If you need to download and convert to `mp4` video format, you need to globally install [ffmpeg](https://ffmpeg.org/download.html).
|
|
127
|
+
> Or use the `--ffmpeg-path` parameter to specify the path to ffmpeg.
|
|
97
128
|
|
|
98
|
-
###
|
|
129
|
+
### Using as CLI Command Line Tool
|
|
99
130
|
|
|
100
|
-
|
|
131
|
+
View all available commands and options:
|
|
101
132
|
|
|
102
133
|
```bash
|
|
103
134
|
m3u8dl --help
|
|
104
135
|
```
|
|
105
136
|
|
|
106
|
-
####
|
|
137
|
+
#### Basic Download
|
|
107
138
|
|
|
108
139
|
```bash
|
|
109
|
-
#
|
|
140
|
+
# Download a single m3u8 file
|
|
110
141
|
m3u8dl https://example.com/video.m3u8
|
|
111
142
|
|
|
112
|
-
#
|
|
113
|
-
m3u8dl https://example.com/video.m3u8 --filename "
|
|
143
|
+
# Specify filename and save directory
|
|
144
|
+
m3u8dl https://example.com/video.m3u8 --filename "My Video" --save-dir "./downloads"
|
|
114
145
|
|
|
115
|
-
#
|
|
146
|
+
# Enable play-while-downloading mode
|
|
116
147
|
m3u8dl https://example.com/video.m3u8 --play
|
|
117
148
|
|
|
118
|
-
#
|
|
149
|
+
# Set thread count (default 4)
|
|
119
150
|
m3u8dl https://example.com/video.m3u8 --thread-num 8
|
|
120
151
|
|
|
121
|
-
#
|
|
152
|
+
# Don't convert to mp4 (only download ts segments)
|
|
122
153
|
m3u8dl https://example.com/video.m3u8 --no-convert
|
|
123
154
|
|
|
124
|
-
#
|
|
155
|
+
# Ignore specified time segments (e.g., skip first 30 seconds and last 60 seconds)
|
|
125
156
|
m3u8dl https://example.com/video.m3u8 --ignore-segments "0-30,END-60"
|
|
126
157
|
```
|
|
127
158
|
|
|
128
|
-
####
|
|
159
|
+
#### Batch Download
|
|
129
160
|
|
|
130
|
-
|
|
161
|
+
**Method 1: Command Line Parameters**
|
|
131
162
|
|
|
132
163
|
```bash
|
|
133
|
-
#
|
|
134
|
-
m3u8dl "
|
|
164
|
+
# Download multiple files, use | to separate filename and URL
|
|
165
|
+
m3u8dl "Episode 1|https://example.com/ep1.m3u8" "Episode 2|https://example.com/ep2.m3u8" --filename "Series Name"
|
|
135
166
|
```
|
|
136
167
|
|
|
137
|
-
|
|
168
|
+
**Method 2: Batch Import from Text File**
|
|
138
169
|
|
|
139
|
-
|
|
170
|
+
Create a `series-list.txt` file with the following format (use `$` to separate filename and URL):
|
|
140
171
|
|
|
141
172
|
```txt
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
173
|
+
Episode 1$https://example.com/ep1.m3u8
|
|
174
|
+
Episode 2$https://example.com/ep2.m3u8
|
|
175
|
+
Episode 3$https://example.com/ep3.m3u8
|
|
145
176
|
```
|
|
146
177
|
|
|
147
|
-
|
|
178
|
+
Then execute:
|
|
148
179
|
|
|
149
180
|
```bash
|
|
150
|
-
m3u8dl
|
|
181
|
+
m3u8dl series-list.txt --filename "Series Name"
|
|
151
182
|
```
|
|
152
183
|
|
|
153
|
-
####
|
|
184
|
+
#### Video Parsing Download
|
|
154
185
|
|
|
155
|
-
|
|
186
|
+
Supports sharing links from platforms like Douyin, Weibo, etc.:
|
|
156
187
|
|
|
157
188
|
```bash
|
|
158
|
-
#
|
|
189
|
+
# Douyin video sharing link
|
|
159
190
|
m3u8dl "https://v.douyin.com/xxxxx/" --type parser
|
|
160
191
|
|
|
161
|
-
#
|
|
192
|
+
# Weibo video sharing link
|
|
162
193
|
m3u8dl "https://weibo.com/xxxxx" --type parser
|
|
163
194
|
```
|
|
164
195
|
|
|
165
|
-
####
|
|
196
|
+
#### Extract m3u8 Address from Web Page
|
|
166
197
|
|
|
167
198
|
```bash
|
|
168
|
-
#
|
|
199
|
+
# Automatically extract m3u8 address from video playback page and download
|
|
169
200
|
m3u8dl "https://example.com/play/12345" --type web
|
|
170
201
|
```
|
|
171
202
|
|
|
172
|
-
####
|
|
203
|
+
#### Video Search Download
|
|
173
204
|
|
|
174
205
|
```bash
|
|
175
|
-
#
|
|
206
|
+
# View search command help
|
|
176
207
|
m3u8dl search --help
|
|
177
208
|
|
|
178
|
-
#
|
|
209
|
+
# Specify collection site API and search download (will cache API address)
|
|
179
210
|
m3u8dl search -u https://api.example.com/provide/vod/
|
|
180
211
|
|
|
181
|
-
#
|
|
182
|
-
m3u8dl search "
|
|
212
|
+
# Search keyword directly
|
|
213
|
+
m3u8dl search "keyword" -u https://api.example.com/provide/vod/
|
|
183
214
|
```
|
|
184
215
|
|
|
185
|
-
>
|
|
216
|
+
> **Disclaimer**: The above are examples only. Please search for available collection site APIs yourself. This tool is only for technical research and learning purposes and does not provide any specific resource information.
|
|
186
217
|
|
|
187
|
-
####
|
|
218
|
+
#### Common Command Line Options
|
|
188
219
|
|
|
189
|
-
|
|
|
190
|
-
|
|
191
|
-
| `-f, --filename <name>` |
|
|
192
|
-
| `-n, --thread-num <number>` |
|
|
193
|
-
| `-p, --play` |
|
|
194
|
-
| `-C, --cache-dir <dirpath>` |
|
|
195
|
-
| `-S, --save-dir <dirpath>` |
|
|
196
|
-
| `--no-convert` |
|
|
197
|
-
| `--no-del-cache` |
|
|
198
|
-
| `--ffmpeg-path <path>` |
|
|
199
|
-
| `-H, --headers <headers>` |
|
|
200
|
-
| `-I, --ignore-segments <time>` |
|
|
201
|
-
| `--debug` |
|
|
202
|
-
| `--lang <lang>` |
|
|
220
|
+
| Option | Description |
|
|
221
|
+
|--------|-------------|
|
|
222
|
+
| `-f, --filename <name>` | Specify filename |
|
|
223
|
+
| `-n, --thread-num <number>` | Set download thread count (default 4) |
|
|
224
|
+
| `-p, --play` | Enable play-while-downloading mode |
|
|
225
|
+
| `-C, --cache-dir <dirpath>` | Specify cache directory |
|
|
226
|
+
| `-S, --save-dir <dirpath>` | Specify save directory |
|
|
227
|
+
| `--no-convert` | Don't convert to mp4 |
|
|
228
|
+
| `--no-del-cache` | Don't delete cache after download completes |
|
|
229
|
+
| `--ffmpeg-path <path>` | Specify ffmpeg path |
|
|
230
|
+
| `-H, --headers <headers>` | Set request headers (JSON format) |
|
|
231
|
+
| `-I, --ignore-segments <time>` | Ignore specified time segments |
|
|
232
|
+
| `--debug` | Enable debug mode |
|
|
233
|
+
| `--lang <lang>` | Set language (zh-CN/en) |
|
|
203
234
|
|
|
204
|
-
### WebUI
|
|
235
|
+
### WebUI Download Management
|
|
205
236
|
|
|
206
|
-
|
|
237
|
+
Start web service to manage download tasks through browser:
|
|
207
238
|
|
|
208
239
|
```bash
|
|
209
|
-
#
|
|
240
|
+
# Start service (default port 6600)
|
|
210
241
|
m3u8dl server
|
|
211
242
|
|
|
212
|
-
#
|
|
243
|
+
# Specify port and access password
|
|
213
244
|
m3u8dl server -p 8080 -t "your-secret-token"
|
|
214
245
|
```
|
|
215
246
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-

|
|
247
|
+
After starting, visit `http://localhost:6600` in your browser to use WebUI.
|
|
219
248
|
|
|
220
|
-
**WebUI
|
|
249
|
+
**WebUI Main Features:**
|
|
221
250
|
|
|
222
|
-
- 📥
|
|
223
|
-
- 📊
|
|
224
|
-
- ⏸️
|
|
225
|
-
- 🗑️
|
|
226
|
-
- ⚙️
|
|
227
|
-
- 🔍
|
|
228
|
-
- 📁
|
|
251
|
+
- 📥 Create download tasks (supports m3u8 links, Weibo and Pipixia video sharing links, video playback page extraction)
|
|
252
|
+
- 📊 View download progress and speed in real-time
|
|
253
|
+
- ⏸️ Pause/Resume download tasks
|
|
254
|
+
- 🗑️ Delete tasks and downloaded files
|
|
255
|
+
- ⚙️ Configure download parameters (thread count, save directory, etc.)
|
|
256
|
+
- 🔍 Search and filter tasks
|
|
257
|
+
- 📁 View completed downloads
|
|
229
258
|
|
|
230
|
-
|
|
259
|
+
**Environment Variable Configuration:**
|
|
231
260
|
|
|
232
261
|
```bash
|
|
233
|
-
#
|
|
262
|
+
# Set port
|
|
234
263
|
export DS_PORT=6600
|
|
235
264
|
|
|
236
|
-
#
|
|
265
|
+
# Set access password
|
|
237
266
|
export DS_SECRET=your-secret-token
|
|
238
267
|
|
|
239
|
-
#
|
|
268
|
+
# Set save directory
|
|
240
269
|
export DS_SAVE_DIR=./downloads
|
|
241
270
|
|
|
242
|
-
#
|
|
271
|
+
# Set cache directory
|
|
243
272
|
export DS_CACHE_DIR=./cache
|
|
244
273
|
|
|
245
|
-
#
|
|
274
|
+
# Set ffmpeg path
|
|
246
275
|
export DS_FFMPEG_PATH=/usr/local/bin/ffmpeg
|
|
247
276
|
|
|
248
|
-
#
|
|
277
|
+
# Enable debug mode
|
|
249
278
|
export DS_DEBUG=1
|
|
250
279
|
|
|
251
|
-
#
|
|
280
|
+
# Limit file access (only allow access to download and cache directories)
|
|
252
281
|
export DS_LIMTE_FILE_ACCESS=1
|
|
253
282
|
```
|
|
254
283
|
|
|
255
|
-
### Node.js API
|
|
284
|
+
### Integration as Node.js API
|
|
256
285
|
|
|
257
|
-
|
|
286
|
+
Call related APIs in your project. Code examples:
|
|
258
287
|
|
|
259
288
|
```ts
|
|
260
289
|
import { m3u8Download, m3u8BatchDownload, VideoParser, getM3u8Urls } from '@lzwme/m3u8-dl';
|
|
261
290
|
|
|
262
|
-
//
|
|
291
|
+
// Example 1: Single file download
|
|
263
292
|
const result = await m3u8Download('https://example.com/video.m3u8', {
|
|
264
|
-
filename: '
|
|
293
|
+
filename: 'My Video',
|
|
265
294
|
saveDir: './downloads',
|
|
266
295
|
threadNum: 8,
|
|
267
296
|
debug: true,
|
|
268
297
|
});
|
|
269
298
|
|
|
270
299
|
if (result.errmsg) {
|
|
271
|
-
console.error('
|
|
300
|
+
console.error('Download failed:', result.errmsg);
|
|
272
301
|
} else {
|
|
273
|
-
console.log('
|
|
302
|
+
console.log('Download successful:', result.filepath);
|
|
274
303
|
}
|
|
275
304
|
|
|
276
|
-
//
|
|
305
|
+
// Example 2: Batch download
|
|
277
306
|
const fileList = [
|
|
278
|
-
'
|
|
279
|
-
'
|
|
307
|
+
'Episode 1$https://example.com/ep1.m3u8',
|
|
308
|
+
'Episode 2$https://example.com/ep2.m3u8',
|
|
280
309
|
];
|
|
281
310
|
await m3u8BatchDownload(fileList, {
|
|
282
|
-
filename: '
|
|
311
|
+
filename: 'Series Name',
|
|
283
312
|
threadNum: 4,
|
|
284
313
|
});
|
|
285
314
|
|
|
286
|
-
//
|
|
315
|
+
// Example 3: Video parsing download (Douyin, Weibo, etc.)
|
|
287
316
|
const parser = new VideoParser();
|
|
288
317
|
const parseResult = await parser.parse('https://v.douyin.com/xxxxx/');
|
|
289
318
|
if (parseResult.data) {
|
|
290
|
-
console.log('
|
|
291
|
-
console.log('
|
|
319
|
+
console.log('Video title:', parseResult.data.title);
|
|
320
|
+
console.log('Video URL:', parseResult.data.url);
|
|
292
321
|
|
|
293
|
-
//
|
|
322
|
+
// Download video
|
|
294
323
|
await parser.download('https://v.douyin.com/xxxxx/', {
|
|
295
324
|
filename: parseResult.data.title,
|
|
296
325
|
});
|
|
297
326
|
}
|
|
298
327
|
|
|
299
|
-
//
|
|
328
|
+
// Example 4: Extract m3u8 addresses from web page
|
|
300
329
|
const urls = await getM3u8Urls({
|
|
301
330
|
url: 'https://example.com/play/12345',
|
|
302
331
|
headers: {
|
|
303
332
|
'User-Agent': 'Mozilla/5.0...',
|
|
304
333
|
},
|
|
305
|
-
deep: 2, //
|
|
334
|
+
deep: 2, // Search depth
|
|
306
335
|
});
|
|
307
|
-
console.log('
|
|
336
|
+
console.log('Extracted addresses:', Array.from(urls.keys()));
|
|
308
337
|
|
|
309
|
-
//
|
|
338
|
+
// Example 5: Specify ffmpeg path
|
|
310
339
|
import ffmpegStatic from 'ffmpeg-static';
|
|
311
340
|
m3u8Download('https://example.com/video.m3u8', {
|
|
312
|
-
filename: '
|
|
313
|
-
ffmpegPath: ffmpegStatic, //
|
|
314
|
-
//
|
|
341
|
+
filename: 'Test Video',
|
|
342
|
+
ffmpegPath: ffmpegStatic, // Use ffmpeg-static package. Suitable for scenarios where ffmpeg is not globally installed
|
|
343
|
+
// Or specify the absolute path of installed ffmpeg (if already in PATH environment variable, no need to specify)
|
|
315
344
|
// ffmpegPath: '/usr/local/bin/ffmpeg',
|
|
316
345
|
});
|
|
317
346
|
```
|
|
318
347
|
|
|
319
|
-
### Docker
|
|
348
|
+
### Docker Deployment
|
|
320
349
|
|
|
321
|
-
####
|
|
350
|
+
#### Using Docker Command
|
|
322
351
|
|
|
323
352
|
```bash
|
|
324
|
-
#
|
|
353
|
+
# Pull image
|
|
325
354
|
docker pull renxia/m3u8dl-dl:latest
|
|
326
355
|
|
|
327
|
-
#
|
|
356
|
+
# Run container
|
|
328
357
|
docker run --rm -it \
|
|
329
358
|
-v ./cache:/app/cache \
|
|
330
359
|
-v ./downloads:/app/downloads \
|
|
@@ -334,9 +363,9 @@ docker run --rm -it \
|
|
|
334
363
|
renxia/m3u8dl-dl:latest
|
|
335
364
|
```
|
|
336
365
|
|
|
337
|
-
####
|
|
366
|
+
#### Using Docker Compose
|
|
338
367
|
|
|
339
|
-
|
|
368
|
+
Create `docker-compose.yml` file:
|
|
340
369
|
|
|
341
370
|
```yml
|
|
342
371
|
services:
|
|
@@ -352,127 +381,179 @@ services:
|
|
|
352
381
|
DS_PORT: '6600'
|
|
353
382
|
DS_SAVE_DIR: '/app/downloads'
|
|
354
383
|
DS_CACHE_DIR: '/app/cache'
|
|
355
|
-
DS_SECRET: '' #
|
|
384
|
+
DS_SECRET: '' # Set access password
|
|
356
385
|
DS_DEBUG: ''
|
|
357
|
-
DS_FFMPEG_PATH: '' #
|
|
358
|
-
DS_LIMTE_FILE_ACCESS: '1' #
|
|
386
|
+
DS_FFMPEG_PATH: '' # Leave empty to use ffmpeg from system PATH
|
|
387
|
+
DS_LIMTE_FILE_ACCESS: '1' # Limit file access
|
|
359
388
|
restart: unless-stopped
|
|
360
389
|
```
|
|
361
390
|
|
|
362
|
-
|
|
391
|
+
Start service:
|
|
363
392
|
|
|
364
393
|
```bash
|
|
365
394
|
docker-compose up -d
|
|
366
395
|
```
|
|
367
396
|
|
|
368
|
-
|
|
397
|
+
After successful deployment, visit `http://your-server-ip:6600` in your browser to use.
|
|
369
398
|
|
|
370
|
-
>
|
|
399
|
+
> **Tip**: The Docker image already includes ffmpeg, no need for additional installation. The image also includes [AriaNg](https://github.com/mayswind/AriaNg) static resources.
|
|
371
400
|
|
|
372
|
-
### Electron
|
|
401
|
+
### Electron Desktop Application
|
|
373
402
|
|
|
374
|
-
|
|
403
|
+
The project supports packaging as an Electron desktop application with richer features:
|
|
375
404
|
|
|
376
|
-
- 🖥️
|
|
377
|
-
- 🌐
|
|
378
|
-
- 📱
|
|
379
|
-
- 🔄
|
|
405
|
+
- 🖥️ Native desktop experience
|
|
406
|
+
- 🌐 Built-in browser, supports extracting video links from web pages
|
|
407
|
+
- 📱 System tray support
|
|
408
|
+
- 🔄 Auto-update functionality
|
|
380
409
|
|
|
381
|
-
|
|
410
|
+
Download the built application:
|
|
382
411
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
cd packages/m3u8dl-app
|
|
412
|
+
- https://m3u8-player.lzw.me/download.html
|
|
413
|
+
- https://github.com/lzwme/m3u8-dl/releases
|
|
386
414
|
|
|
387
|
-
|
|
388
|
-
pnpm install
|
|
415
|
+
### Browser Script Installation and Usage
|
|
389
416
|
|
|
390
|
-
|
|
391
|
-
pnpm dev
|
|
417
|
+
**Installation Steps:**
|
|
392
418
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
419
|
+
1. Install browser extension (choose one):
|
|
420
|
+
- [Violentmonkey](https://violentmonkey.github.io/) (【Recommended】Open-source alternative)
|
|
421
|
+
- [Tampermonkey](https://www.tampermonkey.net/) (【Official】Supports Chrome, Firefox, Edge, Safari, etc.)
|
|
422
|
+
- [Greasemonkey](https://www.greasespot.net/) (Firefox only)
|
|
396
423
|
|
|
397
|
-
|
|
424
|
+
2. Install script:
|
|
425
|
+
- Open Tampermonkey management panel
|
|
426
|
+
- Click "Add new script"
|
|
427
|
+
- Copy content from `client/m3u8-capture.user.js` file
|
|
428
|
+
- Paste into editor and save
|
|
429
|
+
- Or directly visit the link in browser: [https://raw.githubusercontent.com/lzwme/m3u8-dl/refs/heads/main/client/m3u8-capture.user.js](https://raw.githubusercontent.com/lzwme/m3u8-dl/refs/heads/main/client/m3u8-capture.user.js)
|
|
398
430
|
|
|
399
|
-
|
|
400
|
-
-
|
|
431
|
+
3. Configure WebUI address:
|
|
432
|
+
- Visit any web page, click the 🎬 icon in the top right corner to open the capture panel
|
|
433
|
+
- Click the settings button ⚙️
|
|
434
|
+
- Enter your m3u8-dl WebUI address (e.g., `http://localhost:6600`)
|
|
435
|
+
- Save settings
|
|
436
|
+
|
|
437
|
+
**Feature Description:**
|
|
438
|
+
|
|
439
|
+
- **Auto Capture**: The script automatically monitors network requests in web pages, when m3u8 or mp4 video links are detected, automatically adds them to the list
|
|
440
|
+
- **Video Name Extraction**: Prioritizes extracting video names from page `h1`, `h2`, or `document.title`
|
|
441
|
+
- **Jump to Download**: Click the "Jump to Download" button to automatically jump to m3u8-dl WebUI and fill in video link and name (format: `url|name`)
|
|
442
|
+
- **Exclusion Rules**: In settings, you can configure exclusion URL rule list, matching URLs will not show panel and will not capture video links
|
|
443
|
+
- Supports plain string matching (contains match)
|
|
444
|
+
- Supports regular expressions (starts and ends with `/`, e.g., `/example\.com/`)
|
|
445
|
+
|
|
446
|
+
**Usage Example:**
|
|
447
|
+
|
|
448
|
+
1. Visit video playback page
|
|
449
|
+
2. Script automatically captures video links, displayed in the panel in the bottom right corner
|
|
450
|
+
3. Click "Jump to Download" button
|
|
451
|
+
4. Automatically jumps to m3u8-dl WebUI, video link and name are automatically filled
|
|
452
|
+
5. Click "Start Download" in WebUI
|
|
453
|
+
|
|
454
|
+
**Exclusion Rule Configuration Example:**
|
|
455
|
+
|
|
456
|
+
```
|
|
457
|
+
localhost:6600
|
|
458
|
+
127.0.0.1
|
|
459
|
+
/example\.com/
|
|
460
|
+
admin
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
> **Tip**: The script automatically excludes WebUI address pages to avoid capturing in WebUI pages. You can also manually add more exclusion rules.
|
|
401
464
|
|
|
402
|
-
## 🛠️
|
|
465
|
+
## 🛠️ Tech Stack
|
|
403
466
|
|
|
404
|
-
-
|
|
405
|
-
-
|
|
406
|
-
-
|
|
407
|
-
-
|
|
408
|
-
-
|
|
467
|
+
- **Backend**: Node.js + TypeScript + Express + WebSocket
|
|
468
|
+
- **Frontend**: Vue 3 + TypeScript + Vite + Pinia + TailwindCSS
|
|
469
|
+
- **Desktop App**: Electron
|
|
470
|
+
- **Code Quality**: Biome (Linter & Formatter)
|
|
471
|
+
- **Build Tool**: TypeScript Compiler
|
|
409
472
|
|
|
410
|
-
## 💻
|
|
473
|
+
## 💻 Development Guide
|
|
411
474
|
|
|
412
|
-
###
|
|
475
|
+
### Local Development
|
|
413
476
|
|
|
414
477
|
```bash
|
|
415
|
-
#
|
|
478
|
+
# Clone project
|
|
416
479
|
git clone https://github.com/lzwme/m3u8-dl.git
|
|
417
480
|
cd m3u8-dl
|
|
418
481
|
|
|
419
|
-
#
|
|
482
|
+
# Install dependencies
|
|
420
483
|
pnpm install
|
|
421
484
|
|
|
422
|
-
#
|
|
485
|
+
# Development mode (watch file changes and auto-compile)
|
|
423
486
|
pnpm dev
|
|
424
487
|
|
|
425
|
-
#
|
|
488
|
+
# Build project
|
|
426
489
|
pnpm build
|
|
427
490
|
|
|
428
|
-
#
|
|
491
|
+
# Code check
|
|
429
492
|
pnpm lint
|
|
430
493
|
|
|
431
|
-
#
|
|
494
|
+
# Code format
|
|
432
495
|
pnpm format
|
|
433
496
|
|
|
434
|
-
#
|
|
497
|
+
# Fix code issues
|
|
435
498
|
pnpm fix
|
|
436
499
|
```
|
|
437
500
|
|
|
438
|
-
|
|
501
|
+
Build desktop application:
|
|
502
|
+
|
|
503
|
+
```bash
|
|
504
|
+
# Enter application directory
|
|
505
|
+
cd packages/m3u8dl-app
|
|
506
|
+
|
|
507
|
+
# Install dependencies
|
|
508
|
+
pnpm install
|
|
509
|
+
|
|
510
|
+
# Run in development mode
|
|
511
|
+
pnpm dev
|
|
512
|
+
|
|
513
|
+
# Build application
|
|
514
|
+
pnpm build
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### Project Structure
|
|
439
518
|
|
|
440
519
|
```
|
|
441
520
|
m3u8-dl/
|
|
442
|
-
├── src/ #
|
|
443
|
-
│ ├── cli.ts #
|
|
444
|
-
│ ├── lib/ #
|
|
445
|
-
│ ├── server/ # Web
|
|
446
|
-
│ ├── video-parser/ #
|
|
447
|
-
│ └── types/ #
|
|
521
|
+
├── src/ # Source code (TypeScript)
|
|
522
|
+
│ ├── cli.ts # Command line entry
|
|
523
|
+
│ ├── lib/ # Core library
|
|
524
|
+
│ ├── server/ # Web service
|
|
525
|
+
│ ├── video-parser/ # Video parser
|
|
526
|
+
│ └── types/ # Type definitions
|
|
448
527
|
├── packages/
|
|
449
|
-
│ ├── frontend/
|
|
450
|
-
│
|
|
451
|
-
|
|
452
|
-
|
|
528
|
+
│ ├── frontend/ # Vue 3 frontend project
|
|
529
|
+
│ ├── m3u8dl-app/ # Electron desktop application
|
|
530
|
+
│ └── m3u8-capture/ # Browser userscript (TypeScript + Vite)
|
|
531
|
+
├── cjs/ # Compiled CommonJS code
|
|
532
|
+
└── client/ # Frontend build output
|
|
533
|
+
└── m3u8-capture.user.js # Browser video address capture userscript (built from packages/m3u8-capture)
|
|
453
534
|
```
|
|
454
535
|
|
|
455
|
-
###
|
|
536
|
+
### Contributing
|
|
456
537
|
|
|
457
|
-
|
|
538
|
+
Welcome to submit Issues and Pull Requests!
|
|
458
539
|
|
|
459
|
-
1. [Fork](https://github.com/lzwme/m3u8-dl/fork)
|
|
460
|
-
2.
|
|
461
|
-
3.
|
|
462
|
-
4.
|
|
463
|
-
5.
|
|
540
|
+
1. [Fork](https://github.com/lzwme/m3u8-dl/fork) this project
|
|
541
|
+
2. Create feature branch (`git checkout -b feature/AmazingFeature`)
|
|
542
|
+
3. Commit changes (`git commit -m 'Add some AmazingFeature'`)
|
|
543
|
+
4. Push to branch (`git push origin feature/AmazingFeature`)
|
|
544
|
+
5. Open Pull Request
|
|
464
545
|
|
|
465
|
-
|
|
546
|
+
**Welcome to contribute ideas and code!** 🎉
|
|
466
547
|
|
|
467
|
-
## 📚
|
|
548
|
+
## 📚 Related Resources
|
|
468
549
|
|
|
469
|
-
- [ffmpeg
|
|
470
|
-
- [m3u8
|
|
471
|
-
- [
|
|
550
|
+
- [ffmpeg Download](https://ffmpeg.org/download.html) - Video processing tool
|
|
551
|
+
- [m3u8 Format Specification](https://en.wikipedia.org/wiki/M3U) - M3U8 playlist format
|
|
552
|
+
- [Project Changelog](./CHANGELOG.md) - View version update history
|
|
472
553
|
|
|
473
|
-
## 🙏
|
|
554
|
+
## 🙏 Acknowledgments
|
|
474
555
|
|
|
475
|
-
|
|
556
|
+
Thanks to the following projects for inspiration and reference:
|
|
476
557
|
|
|
477
558
|
- [m3u8-multi-thread-downloader](https://github.com/sahadev/m3u8Downloader)
|
|
478
559
|
- [m3u8Utils](https://github.com/liupishui/m3u8Utils)
|
|
@@ -481,7 +562,7 @@ m3u8-dl/
|
|
|
481
562
|
|
|
482
563
|
`@lzwme/m3u8-dl` is released under the MIT license.
|
|
483
564
|
|
|
484
|
-
|
|
565
|
+
This plugin is developed and maintained by [Zhiwen Studio](https://lzw.me).
|
|
485
566
|
|
|
486
567
|
[stars-badge]: https://img.shields.io/github/stars/lzwme/m3u8-dl.svg
|
|
487
568
|
[stars-url]: https://github.com/lzwme/m3u8-dl/stargazers
|