diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeDashManifestCreator.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeDashManifestCreator.java index 2d7f7fe2..a61b8695 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeDashManifestCreator.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeDashManifestCreator.java @@ -23,10 +23,22 @@ import javax.xml.transform.stream.StreamResult; import java.io.IOException; import java.io.StringWriter; import java.nio.charset.StandardCharsets; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; -import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.*; -import static org.schabi.newpipe.extractor.utils.Utils.*; +import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.addClientInfoHeaders; +import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getYoutubeAndroidAppUserAgent; +import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isAndroidStreamingUrl; +import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebStreamingUrl; +import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING; +import static org.schabi.newpipe.extractor.utils.Utils.isBlank; +import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty; /** * Class to generate DASH manifests from YouTube OTF, progressive and ended/post-live-DVR streams. @@ -202,11 +214,11 @@ public final class YoutubeDashManifestCreator { *

In order to generate the DASH manifest, this method will: *

@@ -331,8 +343,8 @@ public final class YoutubeDashManifestCreator { *

In order to generate the DASH manifest, this method will: *

*

* @@ -1423,12 +1437,12 @@ public final class YoutubeDashManifestCreator { // Post-live-DVR/ended livestreams streams don't require an initialization sequence if (!isDeliveryTypeLive) { final Attr initializationAttribute = document.createAttribute("initialization"); - initializationAttribute.setValue(baseUrl + SQ_0 + RN_0); + initializationAttribute.setValue(baseUrl + SQ_0); segmentTemplateElement.setAttributeNode(initializationAttribute); } final Attr mediaAttribute = document.createAttribute("media"); - mediaAttribute.setValue(baseUrl + "&sq=$Number$&rn=$Number$"); + mediaAttribute.setValue(baseUrl + "&sq=$Number$"); segmentTemplateElement.setAttributeNode(mediaAttribute); representationElement.appendChild(segmentTemplateElement); 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 d10fce3b..14b9a9db 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 @@ -1292,21 +1292,9 @@ public class YoutubeStreamExtractor extends StreamExtractor { .setIsVideoOnly(areStreamsVideoOnly) .setItagItem(itagItem); - final int height = itagItem.getHeight(); - if (height > 0) { - final StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(height); - stringBuilder.append("p"); - final int fps = itagItem.getFps(); - if (fps > 30) { - stringBuilder.append(fps); - } - builder.setResolution(stringBuilder.toString()); - } else { - final String resolutionString = itagItem.getResolutionString(); - builder.setResolution(resolutionString != null ? resolutionString - : EMPTY_STRING); - } + final String resolutionString = itagItem.getResolutionString(); + builder.setResolution(resolutionString != null ? resolutionString + : EMPTY_STRING); if (streamType != StreamType.VIDEO_STREAM || !itagInfo.getIsUrl()) { // For YouTube videos on OTF streams and for all streams of post-live streams diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/DeliveryMethod.java b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/DeliveryMethod.java index 444023e5..5d8437b9 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/DeliveryMethod.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/DeliveryMethod.java @@ -48,8 +48,8 @@ public enum DeliveryMethod { * * @see Wikipedia's BitTorrent's page, * Wikipedia's page about torrent files - * and for more information about the - * BitTorrent protocol + * and Bitorrent's website for more information + * about the BitTorrent protocol */ TORRENT } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeDashManifestCreatorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeDashManifestCreatorTest.java index 0cd23fca..fcfffda4 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeDashManifestCreatorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeDashManifestCreatorTest.java @@ -21,7 +21,12 @@ import java.net.URL; import java.util.List; import java.util.Random; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.schabi.newpipe.extractor.ServiceList.YouTube; import static org.schabi.newpipe.extractor.utils.Utils.isBlank; @@ -428,8 +433,8 @@ class YoutubeDashManifestCreatorTest { throw new AssertionError("The value of the initialization attribute is not an URL", e); } - assertTrue(initializationValue.endsWith("&sq=0&rn=0"), - "The value of the initialization attribute doesn't end with &sq=0&rn=0"); + assertTrue(initializationValue.endsWith("&sq=0"), + "The value of the initialization attribute doesn't end with &sq=0"); final String mediaValue = segmentTemplateElement.getAttribute("media"); assertFalse(isBlank(mediaValue), @@ -440,8 +445,8 @@ class YoutubeDashManifestCreatorTest { throw new AssertionError("The value of the media attribute is not an URL", e); } - assertTrue(mediaValue.endsWith("&sq=$Number$&rn=$Number$"), - "The value of the media attribute doesn't end with &sq=$Number$&rn=$Number$"); + assertTrue(mediaValue.endsWith("&sq=$Number$"), + "The value of the media attribute doesn't end with &sq=$Number$"); final String startNumberValue = segmentTemplateElement.getAttribute("startNumber"); assertFalse(isBlank(startNumberValue),