Skip to content

Commit b6ed15a

Browse files
committed
[YouTube] Fix test for non existent streams
Now YouTube returns just "{}" without any better explanation, so ParsingException is thrown by the extractor. Now users won't get told that the video they are trying to watch does not exist at all, but since YouTube literally provides an empty JSON response we have no way to detect if the video does not exist or if there is some other bug in the way we make requests that causes an empty response.
1 parent c8c9af1 commit b6ed15a

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void nonExistentFetch() throws Exception {
8686

8787
final StreamExtractor extractor =
8888
YouTube.getStreamExtractor(BASE_URL + "don-t-exist");
89-
assertThrows(ContentNotAvailableException.class, extractor::fetchPage);
89+
assertThrows(ParsingException.class, extractor::fetchPage);
9090
}
9191

9292
@Test
@@ -280,7 +280,6 @@ protected StreamExtractor createExtractor() throws Exception {
280280
@Nullable @Override public String expectedTextualUploadDate() { return "2021-03-17T12:56:59-07:00"; }
281281
@Override public long expectedLikeCountAtLeast() { return 2300; }
282282
@Override public long expectedDislikeCountAtLeast() { return -1; }
283-
@Override public boolean expectedHasSubtitles() { return false; }
284283
@Override public int expectedStreamSegmentsCount() { return 13; }
285284
@Override public String expectedLicence() { return YOUTUBE_LICENCE; }
286285
@Override public String expectedCategory() { return "News & Politics"; }

0 commit comments

Comments
 (0)