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) {