Skip to content

Commit 8b520d0

Browse files
committedMar 25, 2021
修正AppleTV逻辑
1 parent 71d69de commit 8b520d0

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed
 

‎N_m3u8DL-CLI/Parser.cs

+4-6
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,11 @@ public void Parse()
184184
//针对AppleTv修正
185185
if (m3u8Content.Contains("#EXT-X-DISCONTINUITY") && m3u8Content.Contains("#EXT-X-MAP") && M3u8Url.Contains(".apple.com/"))
186186
{
187-
//第一个不连续标记之后
188-
var sub = m3u8Content.Substring(m3u8Content.IndexOf("#EXT-X-DISCONTINUITY"));
189-
Regex ykmap = new Regex("#EXT-X-MAP:URI=\\\"(.*?)\\\"");
190-
if (ykmap.IsMatch(sub))
187+
//只取加密部分即可
188+
Regex ykmap = new Regex("(#EXT-X-KEY:[\\s\\S]*?)#EXT-X-DISCONTINUITY");
189+
if (ykmap.IsMatch(m3u8Content))
191190
{
192-
var nSub = Regex.Replace(sub, "#EXT-X-MAP:URI=\\\"(.*?)\\\"", "#EXTINF:0,\r\n$1");
193-
m3u8Content = m3u8Content.Replace(sub, nSub).Replace("#EXT-X-DISCONTINUITY", "");
191+
m3u8Content = "#EXTM3U\r\n" + ykmap.Match(m3u8Content).Groups[1].Value + "\r\n#EXT-X-ENDLIST";
194192
}
195193
}
196194

0 commit comments

Comments
 (0)
Please sign in to comment.