Repository navigation
Conversation
播放页开启广告过滤后,videoUrl 会被包装成 /api/proxy/m3u8-filter?url=... 代理地址。下载管理器的 isM3U8Url 只对原始字符串做 /\.m3u8($|\?)/ 正则匹配, 包装后 .m3u8 后面紧跟 &referer=/&sig= 而非结尾或 ?,导致误判为非 HLS 源, FFmpeg 通道被静默强制回退成浏览器分片下载,服务端不产生任何文件。 同时新版 FFmpeg 的 HLS demuxer 对代理改写后的无扩展名播放列表/分片 URL (/api/proxy/m3u8-asset?...)有三层扩展名安全检查(allowed_extensions / allowed_segment_extensions / extension_picky),即使 URL 分类修复后仍会 报 "Invalid data found when processing input"。 - src/lib/download-url.ts: 新增 unwrapProxyPlaylistUrl,识别并解包 m3u8/m3u8-filter/m3u8-asset 代理 URL 还原为真实上游地址 - src/contexts/DownloadManagerContext.tsx: isM3U8Url 判断前先解包代理 URL - src/lib/ffmpeg-download.ts: 为 ffmpeg/ffprobe 统一加上 -allowed_extensions ALL -allowed_segment_extensions ALL -extension_picky 0,放宽代理 URL 的扩展名白名单限制 已通过真实上游 HLS 源完整跑通 /api/download/ffmpeg 全链路验证(登录 → 提交任务 → m3u8-filter → 嵌套变体列表 → m3u8-asset 分片代理 → ffmpeg 拉流),13~17 倍实时速度稳定写入,零报错。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
开启广告过滤(默认开启)后,播放页的
videoUrl会被改写成/api/proxy/m3u8-filter?url=...&sig=...代理地址。点击「FFmpeg 转存下载」时:isM3U8Url只对完整 URL 做/\.m3u8($|\?)/正则匹配。代理包装后.m3u8后面紧跟的是&referer=/&sig=,既不是字符串结尾也不是?,导致被误判成非 HLS 源,ffmpeg通道被静默强制回退成浏览器分片下载,服务端FFMPEG_DOWNLOAD_DIR里完全看不到文件、也没有任何报错。/api/proxy/m3u8-asset?...&kind=segment...)还有三层独立的扩展名安全检查(allowed_extensions/allowed_segment_extensions/extension_picky),会报Invalid data found when processing input,下载依旧失败。修复
src/lib/download-url.ts:新增unwrapProxyPlaylistUrl,识别m3u8/m3u8-filter/m3u8-asset代理路径并解包还原为真实上游地址。src/contexts/DownloadManagerContext.tsx:isM3U8Url判断前先用unwrapProxyPlaylistUrl解包代理 URL 再匹配,正确识别经过广告过滤代理的 HLS 源。src/lib/ffmpeg-download.ts:为 ffmpeg / ffprobe 统一追加-allowed_extensions ALL -allowed_segment_extensions ALL -extension_picky 0,放宽对代理 URL 的扩展名白名单限制。测试
next build(含 TypeScript 类型检查)通过。/api/download/ffmpeg全链路:登录 → 提交任务 →m3u8-filter→ 嵌套变体列表 →m3u8-asset分片代理 → ffmpeg 拉流,稳定在 13~17 倍实时速度写入真实数据,全程零报错。