From 60f639a11527f2a848b5c8b459a05c1ac89ad972 Mon Sep 17 00:00:00 2001 From: nilaoda Date: Sun, 27 Nov 2022 23:18:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4`span`=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4=E7=9A=84=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/N_m3u8DL-RE.Parser/Mp4/MP4TtmlUtil.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/N_m3u8DL-RE.Parser/Mp4/MP4TtmlUtil.cs b/src/N_m3u8DL-RE.Parser/Mp4/MP4TtmlUtil.cs index 7c1757f..e23f8f1 100644 --- a/src/N_m3u8DL-RE.Parser/Mp4/MP4TtmlUtil.cs +++ b/src/N_m3u8DL-RE.Parser/Mp4/MP4TtmlUtil.cs @@ -30,6 +30,8 @@ namespace Mp4SubtitleParser public partial class MP4TtmlUtil { + [GeneratedRegex(" \\w+:\\w+=\\\"[^\\\"]*\\\"")] + private static partial Regex AttrRegex(); [GeneratedRegex("(.+?)<\\/p>")] private static partial Regex LabelFixRegex(); [GeneratedRegex("\\")] @@ -191,6 +193,7 @@ namespace Mp4SubtitleParser XmlNode? headNode = null; XmlNamespaceManager? nsMgr = null; var regex = LabelFixRegex(); + var attrRegex = AttrRegex(); foreach (var item in xmls) { var xmlContent = item; @@ -204,7 +207,12 @@ namespace Mp4SubtitleParser { try { - new XmlDocument().LoadXml($"

{m.Groups[1].Value}

"); + var inner = m.Groups[1].Value; + if (attrRegex.IsMatch(inner)) + { + inner = attrRegex.Replace(inner, ""); + } + new XmlDocument().LoadXml($"

{inner}

"); } catch (Exception) {