From d563e0b87d07015495c8b8b19c21e6219dc0a173 Mon Sep 17 00:00:00 2001 From: nilaoda Date: Sun, 19 Jun 2022 23:56:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3JsonArray=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/N_m3u8DL-RE.Parser/Extractor/DASHExtractor.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/N_m3u8DL-RE.Parser/Extractor/DASHExtractor.cs b/src/N_m3u8DL-RE.Parser/Extractor/DASHExtractor.cs index 58bda88..8d03e08 100644 --- a/src/N_m3u8DL-RE.Parser/Extractor/DASHExtractor.cs +++ b/src/N_m3u8DL-RE.Parser/Extractor/DASHExtractor.cs @@ -316,7 +316,7 @@ namespace N_m3u8DL_RE.Parser.Extractor if (representationMsInfo.ContainsKey("S")) { - var array = representationMsInfo["S"].GetValue(); + var array = representationMsInfo["S"].AsArray(); for (int i = 0; i < array.Count; i++) { var s = array[i]; @@ -342,7 +342,7 @@ namespace N_m3u8DL_RE.Parser.Extractor var segmentIndex = 0; var timescale = representationMsInfo["Timescale"].GetValue(); - foreach (var s in representationMsInfo["S"].GetValue()) + foreach (var s in representationMsInfo["S"].AsArray()) { var duration = DoubleOrNull(s["d"], timescale); for (int j = 0; j < s["r"].GetValue() + 1; j++) @@ -364,7 +364,7 @@ namespace N_m3u8DL_RE.Parser.Extractor var fragments = new JsonArray(); var segmentDuration = DoubleOrNull(representationMsInfo["SegmentDuration"].GetValue(), representationMsInfo.ContainsKey("SegmentDuration") ? representationMsInfo["Timescale"].GetValue() : 1); - foreach (var jsonNode in representationMsInfo["SegmentUrls"].GetValue()) + foreach (var jsonNode in representationMsInfo["SegmentUrls"].AsArray()) { var segmentUrl = jsonNode.GetValue(); if (segmentDuration != -1) @@ -529,10 +529,13 @@ namespace N_m3u8DL_RE.Parser.Extractor }; //统一添加EncryptInfo - playlist.MediaInit.EncryptInfo = new EncryptInfo() + if (playlist.MediaInit != null) { - Method = EncryptMethod.UNKNOWN - }; + playlist.MediaInit.EncryptInfo = new EncryptInfo() + { + Method = EncryptMethod.UNKNOWN + }; + } foreach (var seg in playlist.MediaParts[0].MediaSegments) { seg.EncryptInfo = new EncryptInfo()