过滤不规范的语言标签

This commit is contained in:
nilaoda 2022-11-29 10:17:50 +08:00
parent 8582e69f80
commit 2cda1da5e6
1 changed files with 3 additions and 1 deletions

View File

@ -64,6 +64,7 @@ namespace N_m3u8DL_RE.Parser.Extractor
var ssmElement = xmlDocument.Elements().First(e => e.Name.LocalName == "SmoothStreamingMedia"); var ssmElement = xmlDocument.Elements().First(e => e.Name.LocalName == "SmoothStreamingMedia");
var timeScaleStr = ssmElement.Attribute("TimeScale")?.Value ?? "10000000"; var timeScaleStr = ssmElement.Attribute("TimeScale")?.Value ?? "10000000";
var durationStr = ssmElement.Attribute("Duration")?.Value; var durationStr = ssmElement.Attribute("Duration")?.Value;
var timescale = Convert.ToInt32(timeScaleStr);
var isLiveStr = ssmElement.Attribute("IsLive")?.Value; var isLiveStr = ssmElement.Attribute("IsLive")?.Value;
bool isLive = Convert.ToBoolean(isLiveStr ?? "FALSE"); bool isLive = Convert.ToBoolean(isLiveStr ?? "FALSE");
@ -97,6 +98,8 @@ namespace N_m3u8DL_RE.Parser.Extractor
//StartTimeSubstitution = "{start time}" / "{start_time}" //StartTimeSubstitution = "{start time}" / "{start_time}"
var urlPattern = streamIndex.Attribute("Url")?.Value; var urlPattern = streamIndex.Attribute("Url")?.Value;
var language = streamIndex.Attribute("Language")?.Value; var language = streamIndex.Attribute("Language")?.Value;
//去除不规范的语言标签
if (language?.Length != 3) language = null;
//所有c节点 //所有c节点
var cElements = streamIndex.Elements().Where(e => e.Name.LocalName == "c"); var cElements = streamIndex.Elements().Where(e => e.Name.LocalName == "c");
@ -162,7 +165,6 @@ namespace N_m3u8DL_RE.Parser.Extractor
if (_startTimeStr != null) currentTime = Convert.ToInt64(_startTimeStr); if (_startTimeStr != null) currentTime = Convert.ToInt64(_startTimeStr);
var _duration = Convert.ToInt64(_durationStr); var _duration = Convert.ToInt64(_durationStr);
var timescale = Convert.ToInt32(timeScaleStr);
var _repeatCount = Convert.ToInt64(_repeatCountStr); var _repeatCount = Convert.ToInt64(_repeatCountStr);
if (_repeatCount > 0) if (_repeatCount > 0)
{ {