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 2d7f7fe22..a61b86951 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:
*
* - request the first sequence of the stream (the base URL on which the first
- * sequence parameters are appended (see {@link #RN_0} and {@link #SQ_0})) with a POST
- * or GET request (depending of the client on which the streaming URL comes from);
+ * sequence parameter is appended (see {@link #SQ_0})) with a POST or GET request
+ * (depending of the client on which the streaming URL comes from);
*
* - follow its redirection(s), if any;
- * - save the last URL, remove the first sequence parameters;
+ * - save the last URL, remove the first sequence parameter;
* - use the information provided in the {@link ItagItem} to generate all
* elements of the DASH manifest.
*
@@ -331,8 +343,8 @@ public final class YoutubeDashManifestCreator {
* In order to generate the DASH manifest, this method will:
*
* - request the first sequence of the stream (the base URL on which the first
- * sequence parameters are appended (see {@link #RN_0} and {@link #SQ_0})) with a POST
- * or GET request (depending of the client on which the streaming URL comes from);
+ * sequence parameter is appended (see {@link #SQ_0})) with a POST or GET request
+ * (depending of the client on which the streaming URL comes from);
*
* - follow its redirection(s), if any;
* - save the last URL, remove the first sequence parameters;
@@ -491,7 +503,7 @@ public final class YoutubeDashManifestCreator {
*/
@Nonnull
public static String createDashManifestFromProgressiveStreamingUrl(
- @Nonnull String progressiveStreamingBaseUrl,
+ @Nonnull final String progressiveStreamingBaseUrl,
@Nonnull final ItagItem itagItem,
final long durationSecondsFallback) throws YoutubeDashManifestCreationException {
if (GENERATED_PROGRESSIVE_STREAMS_MANIFESTS.containsKey(progressiveStreamingBaseUrl)) {
@@ -526,12 +538,11 @@ public final class YoutubeDashManifestCreator {
* Get the "initialization" {@link Response response} of a stream.
*
*
- * This method fetches:
+ * This method fetches, for OTF streams and for post-live-DVR streams:
*
- * - for progressive streams, the base URL of the stream with a HEAD request;
- * - for OTF streams and for post-live-DVR streams, the base URL of the stream, to which
- * are appended {@link #SQ_0} and {@link #RN_0} params, with a GET request for streaming
- * URLs from the WEB client and a POST request for the ones from the Android client;
+ * - the base URL of the stream, to which are appended {@link #SQ_0} and {@link #RN_0}
+ * parameters, with a GET request for streaming URLs from the WEB client and a POST request
+ * for the ones from the Android client;
* - for streaming URLs from the WEB client, the {@link #ALR_YES} param is also added.
*
*
@@ -545,6 +556,7 @@ public final class YoutubeDashManifestCreator {
* @throws YoutubeDashManifestCreationException if something goes wrong when fetching the
* "initialization" response and/or its redirects
*/
+ @SuppressWarnings("checkstyle:FinalParameters")
@Nonnull
private static Response getInitializationResponse(@Nonnull String baseStreamingUrl,
@Nonnull final ItagItem itagItem,
@@ -604,11 +616,12 @@ public final class YoutubeDashManifestCreator {
/**
* Append {@link #SQ_0} for post-live-DVR and OTF streams and {@link #RN_0} to all streams.
*
- * @param baseStreamingUrl the base streaming URL to which the param(s) are being appended
+ * @param baseStreamingUrl the base streaming URL to which the parameter(s) are being appended
* @param deliveryType the {@link DeliveryType} of the stream
* @return the base streaming URL to which the param(s) are appended, depending on the
* {@link DeliveryType} of the stream
*/
+ @SuppressWarnings({"checkstyle:FinalParameters", "checkstyle:FinalLocalVariable"})
@Nonnull
private static String appendRnParamAndSqParamIfNeeded(
@Nonnull String baseStreamingUrl,
@@ -644,6 +657,7 @@ public final class YoutubeDashManifestCreator {
* @throws YoutubeDashManifestCreationException if something goes wrong when trying to get the
* response without any redirection
*/
+ @SuppressWarnings("checkstyle:FinalParameters")
@Nonnull
private static Response getStreamingWebUrlWithoutRedirects(
@Nonnull final Downloader downloader,
@@ -1312,7 +1326,7 @@ public final class YoutubeDashManifestCreator {
*
* It generates the following element:
*
- * {@code }
+ * {@code }
*
* (where {@code indexStart} and {@code indexEnd} are gotten from the {@link ItagItem} passed
* as the second parameter)
@@ -1380,9 +1394,9 @@ public final class YoutubeDashManifestCreator {
* {@code 1} for OTF streams;
* - {@code timescale}, which is always {@code 1000};
* - {@code media}, which is the base URL of the stream on which is appended
- * {@code &sq=$Number$&rn=$Number$};
+ * {@code &sq=$Number$};
* - {@code initialization} (only for OTF streams), which is the base URL of the stream
- * on which is appended {@link #SQ_0} and {@link #RN_0}.
+ * on which is appended {@link #SQ_0}.
*
*
*
@@ -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 d10fce3bc..14b9a9db1 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 444023e58..5d8437b9e 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 0cd23fcaf..fcfffda4e 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),