From e844d2aed34e2b305e2d6412d9c885f81caa9374 Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 10 Feb 2021 12:09:35 +0530 Subject: [PATCH] Add dash fields to the ItagItem. --- .../extractor/services/youtube/ItagItem.java | 11 +++++++++ .../extractors/YoutubeStreamExtractor.java | 23 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/ItagItem.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/ItagItem.java index 03d40ce5f..c202ade18 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/ItagItem.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/ItagItem.java @@ -155,4 +155,15 @@ public class ItagItem { public String resolutionString; public int fps = -1; + // Fields for Dash + public int bitrate; + public int width; + public int height; + public int initStart; + public int initEnd; + public int indexStart; + public int indexEnd; + public int height; + public String codec; + } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java index a0c9361b4..d47105aca 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java @@ -949,6 +949,29 @@ public class YoutubeStreamExtractor extends StreamExtractor { + deobfuscateSignature(cipher.get("s")); } + int bitrate = formatData.getInt("bitrate"); + int averageBitrate = formatData.getInt("averageBitrate"); + int width = formatData.getInt("width"); + int height = formatData.getInt("height"); + int initStart = formatData.getInt("initRange.start"); + int initEnd = formatData.getInt("initRange.end"); + int indexStart = formatData.getInt("indexRange.start"); + int indexEnd = formatData.getInt("indexRange.end"); + int fps = formatData.getInt("fps"); + String mimeType = formatData.getString("mimeType", EMPTY_STRING); + String codec = mimeType.contains("codecs") ? mimeType.split("\"")[1] : EMPTY_STRING; + + itagItem.bitrate = bitrate; + itagItem.avgBitrate =averageBitrate; + itagItem.width = width; + itagItem.height = height; + itagItem.initStart = initStart; + itagItem.initEnd = initEnd; + itagItem.indexStart = indexStart; + itagItem.indexEnd = indexEnd; + itagItem.fps = fps; + itagItem.codec = codec; + urlAndItags.put(streamUrl, itagItem); } } catch (UnsupportedEncodingException ignored) {