@lzwme/m3u8-dl 1.4.2 → 1.4.3

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.
@@ -537,21 +537,13 @@ class DLServer {
537
537
  'Access-Control-Allow-Headers': '*',
538
538
  'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
539
539
  'Access-Control-Allow-Origin': '*',
540
+ 'Access-Control-Allow-Credentials': 'true',
540
541
  'Content-Length': String(stats.size),
541
542
  'Content-Type': ext === 'ts' ? 'video/mp2t' : ext === 'm3u8' ? 'application/vnd.apple.mpegurl' : ext === 'mp4' ? 'video/mp4' : 'text/plain',
542
543
  });
543
544
  res.setHeaders(headers);
544
545
  if (ext === 'm3u8' || ('ts' === ext && stats.size < 1024 * 1024 * 3)) {
545
- let content = (0, node_fs_1.readFileSync)(filepath);
546
- if (ext === 'm3u8') {
547
- const baseDirName = (0, node_path_1.basename)(filepath, '.m3u8');
548
- content = content
549
- .toString('utf8')
550
- .split('\n')
551
- .map(line => (line.endsWith('.ts') && !line.includes('/') ? `${baseDirName}/${line}` : line))
552
- .join('\n');
553
- }
554
- res.send(content);
546
+ res.send((0, node_fs_1.readFileSync)(filepath));
555
547
  utils_js_1.logger.debug('[Localplay]file sent:', (0, console_log_colors_1.gray)(filepath), 'Size:', stats.size, 'bytes');
556
548
  }
557
549
  else {
package/client/index.html CHANGED
@@ -744,7 +744,7 @@ services:
744
744
  this.ws.close();
745
745
  }
746
746
 
747
- const ws = new WebSocket(`ws://${location.host}/ws?token=${this.token}`);
747
+ const ws = new WebSocket(`${location.protocol === 'https:' ? 'wss' : 'ws'}://${location.host}/ws?token=${this.token}`);
748
748
  this.ws = ws;
749
749
  ws.onmessage = (e) => {
750
750
  let { type, data } = T.safeJSONParse(e.data);
@@ -832,7 +832,7 @@ services:
832
832
  html: `
833
833
  <div class="text-left">
834
834
  <div class="flex flex-row gap-4">
835
- <input type="text" id="playUrl" placeholder="[实验性]输入列表页或播放页地址,提取m3u8链接" autocomplete="off" id="urlInput" class="flex-1 border border-gray-300 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-400" value="">
835
+ <input type="text" id="playUrl" placeholder="[实验性]输入视频播放页地址,尝试提取m3u8下载链接" autocomplete="off" id="urlInput" class="flex-1 border border-gray-300 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-400" value="">
836
836
  <div class="flex flex-row gap-1">
837
837
  <button type="button" id="getM3u8UrlsBtn" class="player-btn px-2 py-1 bg-blue-600 text-white rounded hover:bg-blue-700 focus:outline-none">
838
838
  提取
@@ -840,13 +840,6 @@ services:
840
840
  </div>
841
841
  </div>
842
842
 
843
- <div class="mt-4">
844
- <div class="flex flex-row gap-2 items-center">
845
- <input id="subUrlRegex" class="flex-1 p-2 border rounded-lg focus:border-blue-500" placeholder="[实验性](可选)播放页链接特征规则">
846
- </div>
847
- <p class="ml-2 mt-1 text-sm text-gray-500">用于从视频列表页准确识别播放地址。如:<code>play/845-1-</code></p>
848
- </div>
849
-
850
843
  <div class="mt-4">
851
844
  <label class="block text-sm font-bold text-gray-700 mb-1">视频链接(每行一个,支持m3u8地址及抖音、微博、皮皮虾视频分享链接)</label>
852
845
  <textarea id="downloadUrls" class="w-full p-2 border rounded-lg focus:ring-blue-500" rows="3" placeholder="格式: URL | 名称(可选)、名称 | URL"></textarea>
@@ -937,9 +930,7 @@ services:
937
930
  btn.setAttribute('disabled', 'disabled');
938
931
  btn.innerText = '解析中...';
939
932
 
940
- const headers = document.getElementById('headers').value.trim();
941
- const subUrlRegex = document.getElementById('subUrlRegex').value.trim();
942
- T.post('/api/getM3u8Urls', { url, headers, subUrlRegex }).then(r => {
933
+ T.post('/api/getM3u8Urls', { url, headers: document.getElementById('headers').value.trim() }).then(r => {
943
934
  if (Array.isArray(r.data)) {
944
935
  document.getElementById('downloadUrls').value = r.data.map(d => d.join(' | ')).join('\n');
945
936
  T.toast(r.message || `解析完成!获取到 ${r.data.length} 个地址`);
@@ -1073,11 +1064,10 @@ services:
1073
1064
  },
1074
1065
  /** 边下边播 */
1075
1066
  localPlay: function (task) {
1076
- const filepath = task.localVideo || task.localM3u8;
1077
- const url = location.origin + `/localplay/${encodeURIComponent(filepath)}`;
1067
+ const url = location.origin + `/localplay/${encodeURIComponent(task.localVideo || '') || task.localM3u8}`;
1078
1068
  console.log(task);
1079
1069
  Swal.fire({
1080
- title: task?.options.filename || task.url,
1070
+ title: task.options?.filename || task.url,
1081
1071
  width: '1000px',
1082
1072
  padding: 0,
1083
1073
  allowOutsideClick: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lzwme/m3u8-dl",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Batch download of m3u8 files and convert to mp4",
5
5
  "main": "cjs/index.js",
6
6
  "types": "cjs/index.d.ts",
@@ -44,24 +44,24 @@
44
44
  "registry": "https://registry.npmjs.com"
45
45
  },
46
46
  "devDependencies": {
47
- "@biomejs/biome": "^2.1.2",
48
- "@eslint/js": "^9.31.0",
47
+ "@biomejs/biome": "^2.2.2",
48
+ "@eslint/js": "^9.34.0",
49
49
  "@lzwme/fed-lint-helper": "^2.6.6",
50
50
  "@types/express": "^5.0.3",
51
- "@types/m3u8-parser": "^7.2.2",
52
- "@types/node": "^24.0.15",
51
+ "@types/m3u8-parser": "^7.2.3",
52
+ "@types/node": "^24.3.0",
53
53
  "@types/ws": "^8.18.1",
54
- "@typescript-eslint/eslint-plugin": "^8.37.0",
55
- "@typescript-eslint/parser": "^8.37.0",
56
- "eslint": "^9.31.0",
54
+ "@typescript-eslint/eslint-plugin": "^8.41.0",
55
+ "@typescript-eslint/parser": "^8.41.0",
56
+ "eslint": "^9.34.0",
57
57
  "eslint-config-prettier": "^10.1.8",
58
- "eslint-plugin-prettier": "^5.5.3",
58
+ "eslint-plugin-prettier": "^5.5.4",
59
59
  "express": "^5.1.0",
60
60
  "husky": "^9.1.7",
61
61
  "prettier": "^3.6.2",
62
62
  "standard-version": "^9.5.0",
63
- "typescript": "^5.8.3",
64
- "typescript-eslint": "^8.37.0",
63
+ "typescript": "^5.9.2",
64
+ "typescript-eslint": "^8.41.0",
65
65
  "ws": "^8.18.3"
66
66
  },
67
67
  "dependencies": {