From daaae54445fe28d7605c012d7dda52765fda2af5 Mon Sep 17 00:00:00 2001
From: Vladyslav Kalinin
Date: Fri, 8 Jul 2022 22:32:23 +0200
Subject: [PATCH 1/6] Fixing up tests and the bugs they exposed
---
.../youtube/YoutubeParsingHelper.java | 2 +-
.../YoutubeMixPlaylistExtractor.java | 6 +-
.../YoutubeMusicSearchExtractor.java | 62 +++++++++----------
.../bandcamp/BandcampSearchExtractorTest.java | 3 +-
.../PeertubePlaylistExtractorTest.java | 4 +-
.../YoutubeMixPlaylistExtractorTest.java | 2 +
.../YoutubeStreamExtractorDefaultTest.java | 8 ---
7 files changed, 38 insertions(+), 49 deletions(-)
diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java
index 566da52170..2fef3160d6 100644
--- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java
+++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java
@@ -233,7 +233,7 @@ private YoutubeParsingHelper() {
* The three digits at the end can be random, but are required.
*
*/
- private static final String CONSENT_COOKIE_VALUE = "PENDING+";
+ private static final String CONSENT_COOKIE_VALUE = "YES+";
/**
* YouTube {@code CONSENT} cookie.
diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java
index 49225330be..a165c209d1 100644
--- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java
+++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java
@@ -2,7 +2,7 @@
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.DISABLE_PRETTY_PRINT_PARAMETER;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.YOUTUBEI_V1_URL;
-import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.addClientInfoHeaders;
+import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.addYouTubeHeaders;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.extractCookieValue;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.extractPlaylistTypeFromPlaylistId;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getKey;
@@ -89,7 +89,7 @@ public void onFetchPage(@Nonnull final Downloader downloader)
final byte[] body = JsonWriter.string(jsonBody.done()).getBytes(StandardCharsets.UTF_8);
final Map> headers = new HashMap<>();
- addClientInfoHeaders(headers);
+ addYouTubeHeaders(headers);
final Response response = getDownloader().post(YOUTUBEI_V1_URL + "next?key=" + getKey()
+ DISABLE_PRETTY_PRINT_PARAMETER, headers, body, localization);
@@ -212,7 +212,7 @@ public InfoItemsPage getPage(final Page page) throws IOException
final StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
final Map> headers = new HashMap<>();
- addClientInfoHeaders(headers);
+ addYouTubeHeaders(headers);
final Response response = getDownloader().post(page.getUrl(), headers, page.getBody(),
getExtractorLocalization());
diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicSearchExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicSearchExtractor.java
index bcbabbcb75..7bf10ef36f 100644
--- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicSearchExtractor.java
+++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicSearchExtractor.java
@@ -142,46 +142,42 @@ public String getUrl() throws ParsingException {
@Nonnull
@Override
public String getSearchSuggestion() throws ParsingException {
- final JsonObject itemSectionRenderer = JsonUtils.getArray(JsonUtils.getArray(initialData,
- "contents.tabbedSearchResultsRenderer.tabs").getObject(0),
- "tabRenderer.content.sectionListRenderer.contents")
+ for (final Object obj : initialData
+ .getObject("contents")
+ .getObject("tabbedSearchResultsRenderer")
+ .getArray("tabs")
.getObject(0)
- .getObject("itemSectionRenderer");
- if (itemSectionRenderer.isEmpty()) {
- return "";
- }
+ .getObject("tabRenderer")
+ .getObject("content")
+ .getObject("sectionListRenderer")
+ .getArray("contents")) {
+ final JsonObject itemSectionRenderer =
+ ((JsonObject) obj).getObject("itemSectionRenderer");
+
+ if (itemSectionRenderer.isEmpty()) {
+ continue;
+ }
- final JsonObject didYouMeanRenderer = itemSectionRenderer.getArray("contents")
- .getObject(0).getObject("didYouMeanRenderer");
- final JsonObject showingResultsForRenderer = itemSectionRenderer.getArray("contents")
- .getObject(0)
- .getObject("showingResultsForRenderer");
-
- if (!didYouMeanRenderer.isEmpty()) {
- return getTextFromObject(didYouMeanRenderer.getObject("correctedQuery"));
- } else if (!showingResultsForRenderer.isEmpty()) {
- return JsonUtils.getString(showingResultsForRenderer,
- "correctedQueryEndpoint.searchEndpoint.query");
- } else {
- return "";
+ final JsonObject didYouMeanRenderer = itemSectionRenderer.getArray("contents")
+ .getObject(0).getObject("didYouMeanRenderer");
+ final JsonObject showingResultsForRenderer = itemSectionRenderer.getArray("contents")
+ .getObject(0)
+ .getObject("showingResultsForRenderer");
+
+ if (!didYouMeanRenderer.isEmpty()) {
+ return getTextFromObject(didYouMeanRenderer.getObject("correctedQuery"));
+ } else if (!showingResultsForRenderer.isEmpty()) {
+ return JsonUtils.getString(showingResultsForRenderer,
+ "correctedQueryEndpoint.searchEndpoint.query");
+ }
}
+
+ return "";
}
@Override
public boolean isCorrectedSearch() throws ParsingException {
- final JsonObject itemSectionRenderer = JsonUtils.getArray(JsonUtils.getArray(initialData,
- "contents.tabbedSearchResultsRenderer.tabs").getObject(0),
- "tabRenderer.content.sectionListRenderer.contents")
- .getObject(0)
- .getObject("itemSectionRenderer");
- if (itemSectionRenderer.isEmpty()) {
- return false;
- }
-
- final JsonObject firstContent = itemSectionRenderer.getArray("contents").getObject(0);
-
- return firstContent.has("didYouMeanRenderer")
- || firstContent.has("showingResultsForRenderer");
+ return this.getSearchSuggestion() != "";
}
@Nonnull
diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java
index 4c9a3172b3..fddfd62b46 100644
--- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java
+++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java
@@ -83,8 +83,7 @@ public void testAlbumSearch() throws ExtractionException, IOException {
assertEquals("https://c418.bandcamp.com/album/minecraft-volume-alpha", minecraft.getUrl());
// Verify that playlist tracks counts get extracted correctly
- assertEquals(24, ((PlaylistInfoItem) minecraft).getStreamCount());
-
+ assertTrue(((PlaylistInfoItem) minecraft).getStreamCount() > 0);
}
/**
diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubePlaylistExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubePlaylistExtractorTest.java
index 15e16bc137..8164a06e15 100644
--- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubePlaylistExtractorTest.java
+++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubePlaylistExtractorTest.java
@@ -43,7 +43,7 @@ public void testGetUploaderUrl() throws ParsingException {
@Test
public void testGetUploaderAvatarUrl() throws ParsingException {
- assertEquals("https://framatube.org/lazy-static/avatars/c6801ff9-cb49-42e6-b2db-3db623248115.jpg", extractor.getUploaderAvatarUrl());
+ assertEquals("https://framatube.org/lazy-static/avatars/cd0f781d-0287-4be2-94f1-24cd732337b2.jpg", extractor.getUploaderAvatarUrl());
}
@Test
@@ -68,7 +68,7 @@ public void testGetSubChannelName() throws ParsingException {
@Test
public void testGetSubChannelAvatarUrl() throws ParsingException {
- assertEquals("https://framatube.org/lazy-static/avatars/e801ccce-8694-4309-b0ab-e6f0e552ef77.png",
+ assertEquals("https://framatube.org/lazy-static/avatars/637753af-fcf2-4b61-88f9-b9857c953457.png",
extractor.getSubChannelAvatarUrl());
}
}
diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java
index b562d6594d..1a130637b9 100644
--- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java
+++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java
@@ -11,6 +11,7 @@
import com.grack.nanojson.JsonWriter;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.schabi.newpipe.downloader.DownloaderFactory;
import org.schabi.newpipe.extractor.ExtractorAsserts;
@@ -220,6 +221,7 @@ void getPlaylistType() throws ParsingException {
}
}
+ @Disabled("Video doesn't exist")
public static class MyMix {
private static final String VIDEO_ID = "_AzeUSL9lZc";
diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java
index f1506154b6..facfdbc68e 100644
--- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java
+++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java
@@ -407,14 +407,6 @@ public static void setUp() throws Exception {
@Nullable @Override public String expectedTextualUploadDate() { return "2019-06-12"; }
@Override public long expectedLikeCountAtLeast() { return 70000; }
@Override public long expectedDislikeCountAtLeast() { return -1; }
- @Override public List expectedMetaInfo() throws MalformedURLException {
- return Collections.singletonList(new MetaInfo(
- EMPTY_STRING,
- new Description("Funk is a German public broadcast service.", Description.PLAIN_TEXT),
- Collections.singletonList(new URL("https://de.wikipedia.org/wiki/Funk_(Medienangebot)?wprov=yicw1")),
- Collections.singletonList("Wikipedia (German)")
- ));
- }
@Override public boolean expectedUploaderVerified() { return true; }
@Override public String expectedLicence() { return YOUTUBE_LICENCE; }
@Override public String expectedCategory() { return "Education"; }
From f0ed685788cb948001cdc0c0ad5bf44ce2947625 Mon Sep 17 00:00:00 2001
From: Vladyslav Kalinin
Date: Fri, 8 Jul 2022 22:32:23 +0200
Subject: [PATCH 2/6] Fixing up tests and the bugs they exposed
---
.../youtube/YoutubeParsingHelper.java | 2 +-
.../YoutubeMixPlaylistExtractor.java | 6 +-
.../YoutubeMusicSearchExtractor.java | 62 +++++++++----------
.../bandcamp/BandcampSearchExtractorTest.java | 3 +-
.../PeertubePlaylistExtractorTest.java | 4 +-
.../YoutubeMixPlaylistExtractorTest.java | 2 +
.../YoutubeStreamExtractorDefaultTest.java | 8 ---
7 files changed, 38 insertions(+), 49 deletions(-)
diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java
index 566da52170..2fef3160d6 100644
--- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java
+++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java
@@ -233,7 +233,7 @@ private YoutubeParsingHelper() {
* The three digits at the end can be random, but are required.
*
*/
- private static final String CONSENT_COOKIE_VALUE = "PENDING+";
+ private static final String CONSENT_COOKIE_VALUE = "YES+";
/**
* YouTube {@code CONSENT} cookie.
diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java
index 49225330be..a165c209d1 100644
--- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java
+++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java
@@ -2,7 +2,7 @@
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.DISABLE_PRETTY_PRINT_PARAMETER;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.YOUTUBEI_V1_URL;
-import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.addClientInfoHeaders;
+import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.addYouTubeHeaders;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.extractCookieValue;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.extractPlaylistTypeFromPlaylistId;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getKey;
@@ -89,7 +89,7 @@ public void onFetchPage(@Nonnull final Downloader downloader)
final byte[] body = JsonWriter.string(jsonBody.done()).getBytes(StandardCharsets.UTF_8);
final Map> headers = new HashMap<>();
- addClientInfoHeaders(headers);
+ addYouTubeHeaders(headers);
final Response response = getDownloader().post(YOUTUBEI_V1_URL + "next?key=" + getKey()
+ DISABLE_PRETTY_PRINT_PARAMETER, headers, body, localization);
@@ -212,7 +212,7 @@ public InfoItemsPage getPage(final Page page) throws IOException
final StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
final Map> headers = new HashMap<>();
- addClientInfoHeaders(headers);
+ addYouTubeHeaders(headers);
final Response response = getDownloader().post(page.getUrl(), headers, page.getBody(),
getExtractorLocalization());
diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicSearchExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicSearchExtractor.java
index bcbabbcb75..7bf10ef36f 100644
--- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicSearchExtractor.java
+++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicSearchExtractor.java
@@ -142,46 +142,42 @@ public String getUrl() throws ParsingException {
@Nonnull
@Override
public String getSearchSuggestion() throws ParsingException {
- final JsonObject itemSectionRenderer = JsonUtils.getArray(JsonUtils.getArray(initialData,
- "contents.tabbedSearchResultsRenderer.tabs").getObject(0),
- "tabRenderer.content.sectionListRenderer.contents")
+ for (final Object obj : initialData
+ .getObject("contents")
+ .getObject("tabbedSearchResultsRenderer")
+ .getArray("tabs")
.getObject(0)
- .getObject("itemSectionRenderer");
- if (itemSectionRenderer.isEmpty()) {
- return "";
- }
+ .getObject("tabRenderer")
+ .getObject("content")
+ .getObject("sectionListRenderer")
+ .getArray("contents")) {
+ final JsonObject itemSectionRenderer =
+ ((JsonObject) obj).getObject("itemSectionRenderer");
+
+ if (itemSectionRenderer.isEmpty()) {
+ continue;
+ }
- final JsonObject didYouMeanRenderer = itemSectionRenderer.getArray("contents")
- .getObject(0).getObject("didYouMeanRenderer");
- final JsonObject showingResultsForRenderer = itemSectionRenderer.getArray("contents")
- .getObject(0)
- .getObject("showingResultsForRenderer");
-
- if (!didYouMeanRenderer.isEmpty()) {
- return getTextFromObject(didYouMeanRenderer.getObject("correctedQuery"));
- } else if (!showingResultsForRenderer.isEmpty()) {
- return JsonUtils.getString(showingResultsForRenderer,
- "correctedQueryEndpoint.searchEndpoint.query");
- } else {
- return "";
+ final JsonObject didYouMeanRenderer = itemSectionRenderer.getArray("contents")
+ .getObject(0).getObject("didYouMeanRenderer");
+ final JsonObject showingResultsForRenderer = itemSectionRenderer.getArray("contents")
+ .getObject(0)
+ .getObject("showingResultsForRenderer");
+
+ if (!didYouMeanRenderer.isEmpty()) {
+ return getTextFromObject(didYouMeanRenderer.getObject("correctedQuery"));
+ } else if (!showingResultsForRenderer.isEmpty()) {
+ return JsonUtils.getString(showingResultsForRenderer,
+ "correctedQueryEndpoint.searchEndpoint.query");
+ }
}
+
+ return "";
}
@Override
public boolean isCorrectedSearch() throws ParsingException {
- final JsonObject itemSectionRenderer = JsonUtils.getArray(JsonUtils.getArray(initialData,
- "contents.tabbedSearchResultsRenderer.tabs").getObject(0),
- "tabRenderer.content.sectionListRenderer.contents")
- .getObject(0)
- .getObject("itemSectionRenderer");
- if (itemSectionRenderer.isEmpty()) {
- return false;
- }
-
- final JsonObject firstContent = itemSectionRenderer.getArray("contents").getObject(0);
-
- return firstContent.has("didYouMeanRenderer")
- || firstContent.has("showingResultsForRenderer");
+ return this.getSearchSuggestion() != "";
}
@Nonnull
diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java
index 4c9a3172b3..fddfd62b46 100644
--- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java
+++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java
@@ -83,8 +83,7 @@ public void testAlbumSearch() throws ExtractionException, IOException {
assertEquals("https://c418.bandcamp.com/album/minecraft-volume-alpha", minecraft.getUrl());
// Verify that playlist tracks counts get extracted correctly
- assertEquals(24, ((PlaylistInfoItem) minecraft).getStreamCount());
-
+ assertTrue(((PlaylistInfoItem) minecraft).getStreamCount() > 0);
}
/**
diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubePlaylistExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubePlaylistExtractorTest.java
index 15e16bc137..8164a06e15 100644
--- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubePlaylistExtractorTest.java
+++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubePlaylistExtractorTest.java
@@ -43,7 +43,7 @@ public void testGetUploaderUrl() throws ParsingException {
@Test
public void testGetUploaderAvatarUrl() throws ParsingException {
- assertEquals("https://framatube.org/lazy-static/avatars/c6801ff9-cb49-42e6-b2db-3db623248115.jpg", extractor.getUploaderAvatarUrl());
+ assertEquals("https://framatube.org/lazy-static/avatars/cd0f781d-0287-4be2-94f1-24cd732337b2.jpg", extractor.getUploaderAvatarUrl());
}
@Test
@@ -68,7 +68,7 @@ public void testGetSubChannelName() throws ParsingException {
@Test
public void testGetSubChannelAvatarUrl() throws ParsingException {
- assertEquals("https://framatube.org/lazy-static/avatars/e801ccce-8694-4309-b0ab-e6f0e552ef77.png",
+ assertEquals("https://framatube.org/lazy-static/avatars/637753af-fcf2-4b61-88f9-b9857c953457.png",
extractor.getSubChannelAvatarUrl());
}
}
diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java
index b562d6594d..1a130637b9 100644
--- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java
+++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java
@@ -11,6 +11,7 @@
import com.grack.nanojson.JsonWriter;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.schabi.newpipe.downloader.DownloaderFactory;
import org.schabi.newpipe.extractor.ExtractorAsserts;
@@ -220,6 +221,7 @@ void getPlaylistType() throws ParsingException {
}
}
+ @Disabled("Video doesn't exist")
public static class MyMix {
private static final String VIDEO_ID = "_AzeUSL9lZc";
diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java
index f1506154b6..facfdbc68e 100644
--- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java
+++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java
@@ -407,14 +407,6 @@ public static void setUp() throws Exception {
@Nullable @Override public String expectedTextualUploadDate() { return "2019-06-12"; }
@Override public long expectedLikeCountAtLeast() { return 70000; }
@Override public long expectedDislikeCountAtLeast() { return -1; }
- @Override public List expectedMetaInfo() throws MalformedURLException {
- return Collections.singletonList(new MetaInfo(
- EMPTY_STRING,
- new Description("Funk is a German public broadcast service.", Description.PLAIN_TEXT),
- Collections.singletonList(new URL("https://de.wikipedia.org/wiki/Funk_(Medienangebot)?wprov=yicw1")),
- Collections.singletonList("Wikipedia (German)")
- ));
- }
@Override public boolean expectedUploaderVerified() { return true; }
@Override public String expectedLicence() { return YOUTUBE_LICENCE; }
@Override public String expectedCategory() { return "Education"; }
From 590ab6b1adf506ea0cc50025a52249a3978fe7ee Mon Sep 17 00:00:00 2001
From: Vladyslav Kalinin
Date: Sun, 24 Jul 2022 17:16:42 +0200
Subject: [PATCH 3/6] Removed redundant this.
---
.../youtube/extractors/YoutubeMusicSearchExtractor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicSearchExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicSearchExtractor.java
index 7bf10ef36f..e3965d3c9c 100644
--- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicSearchExtractor.java
+++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicSearchExtractor.java
@@ -177,7 +177,7 @@ public String getSearchSuggestion() throws ParsingException {
@Override
public boolean isCorrectedSearch() throws ParsingException {
- return this.getSearchSuggestion() != "";
+ return getSearchSuggestion() != "";
}
@Nonnull
From 0b0f59b20a02605950791db66f09054c7ec06007 Mon Sep 17 00:00:00 2001
From: Vladyslav Kalinin
Date: Sun, 24 Jul 2022 22:38:06 +0200
Subject: [PATCH 4/6] Re-enabled MyMix tests with a valid video ID
---
.../services/youtube/YoutubeMixPlaylistExtractorTest.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java
index 1a130637b9..e1910e1498 100644
--- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java
+++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java
@@ -221,9 +221,8 @@ void getPlaylistType() throws ParsingException {
}
}
- @Disabled("Video doesn't exist")
public static class MyMix {
- private static final String VIDEO_ID = "_AzeUSL9lZc";
+ private static final String VIDEO_ID = "YVkUvmDQ3HY";
@BeforeAll
public static void setUp() throws Exception {
@@ -251,7 +250,7 @@ void getName() throws Exception {
void getThumbnailUrl() throws Exception {
final String thumbnailUrl = extractor.getThumbnailUrl();
assertIsSecureUrl(thumbnailUrl);
- assertTrue(thumbnailUrl.startsWith("https://i.ytimg.com/vi/_AzeUSL9lZc"));
+ assertTrue(thumbnailUrl.startsWith("https://i.ytimg.com/vi/" + VIDEO_ID));
}
@Test
From f009705c9811672bff03dbb466ecb1049a20fc56 Mon Sep 17 00:00:00 2001
From: Vladyslav Kalinin
Date: Sun, 24 Jul 2022 22:42:46 +0200
Subject: [PATCH 5/6] Fixing BandcampSearchExtractorTest.testAlbumSearch
---
.../services/bandcamp/BandcampSearchExtractorTest.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java
index fddfd62b46..ea0ad8f5f1 100644
--- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java
+++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java
@@ -77,13 +77,13 @@ public void testAlbumSearch() throws ExtractionException, IOException {
.getItems().get(0);
// Minecraft volume alpha should be the first result, no?
- assertEquals("Minecraft - Volume Alpha", minecraft.getName());
+ assertEquals("Minecraft: Volume Alpha (cover)", minecraft.getName());
assertTrue(minecraft.getThumbnailUrl().endsWith(".jpg"));
assertTrue(minecraft.getThumbnailUrl().contains("f4.bcbits.com/img/"));
- assertEquals("https://c418.bandcamp.com/album/minecraft-volume-alpha", minecraft.getUrl());
+ assertEquals("https://chromacat248.bandcamp.com/album/minecraft-volume-alpha-cover", minecraft.getUrl());
// Verify that playlist tracks counts get extracted correctly
- assertTrue(((PlaylistInfoItem) minecraft).getStreamCount() > 0);
+ assertEquals(3, ((PlaylistInfoItem) minecraft).getStreamCount());
}
/**
From a1b6d9c0f12f71135d24f287b6701f4f37337fe6 Mon Sep 17 00:00:00 2001
From: Vladyslav Kalinin
Date: Sun, 24 Jul 2022 22:48:29 +0200
Subject: [PATCH 6/6] Fixing YoutubeStreamExtractorLivestreamTest
---
.../stream/YoutubeStreamExtractorLivestreamTest.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorLivestreamTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorLivestreamTest.java
index 81fbf126a1..65a728fb05 100644
--- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorLivestreamTest.java
+++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorLivestreamTest.java
@@ -19,7 +19,7 @@
public class YoutubeStreamExtractorLivestreamTest extends DefaultStreamExtractorTest {
private static final String RESOURCE_PATH = DownloaderFactory.RESOURCE_PATH + "services/youtube/extractor/stream/";
- private static final String ID = "5qap5aO4i9A";
+ private static final String ID = "jfKfPfyJRdk";
private static final int TIMESTAMP = 1737;
private static final String URL = YoutubeStreamExtractorDefaultTest.BASE_URL + ID + "&t=" + TIMESTAMP;
private static StreamExtractor extractor;
@@ -57,9 +57,9 @@ public void testUploaderName() throws Exception {
@Override public long expectedLength() { return 0; }
@Override public long expectedTimestamp() { return TIMESTAMP; }
@Override public long expectedViewCountAtLeast() { return 0; }
- @Nullable @Override public String expectedUploadDate() { return "2020-02-22 00:00:00.000"; }
- @Nullable @Override public String expectedTextualUploadDate() { return "2020-02-22"; }
- @Override public long expectedLikeCountAtLeast() { return 825000; }
+ @Nullable @Override public String expectedUploadDate() { return "2020-07-12 00:00:00.000"; }
+ @Nullable @Override public String expectedTextualUploadDate() { return "2020-07-12"; }
+ @Override public long expectedLikeCountAtLeast() { return 280_000; }
@Override public long expectedDislikeCountAtLeast() { return -1; }
@Override public boolean expectedHasSubtitles() { return false; }
@Nullable @Override public String expectedDashMpdUrlContains() { return "https://manifest.googlevideo.com/api/manifest/dash/"; }