[YouTube] Add a StreamExtractor test for a video without visual metadata
The video "Makani’s first commercial-scale energy kite" (video ID: An8vtD1FDqs), which has this behavior, is used for the new test, NoVisualMetadataVideoTest, added in YoutubeStreamExtractorDefaultTest. Tests of elements who throw an exception in this case (subscriber count, like count, uploader avatar URL) test if the ParsingException exception is thrown by YoutubeStreamExtractor.
This commit is contained in:
parent
aa9a8ca23c
commit
e66fed41d6
1 changed files with 63 additions and 0 deletions
|
@ -428,6 +428,69 @@ public class YoutubeStreamExtractorDefaultTest {
|
|||
// @formatter:on
|
||||
}
|
||||
|
||||
public static class NoVisualMetadataVideoTest extends DefaultStreamExtractorTest {
|
||||
// Video without visual metadata on YouTube clients (video title, upload date, channel name,
|
||||
// comments, ...)
|
||||
private static final String ID = "An8vtD1FDqs";
|
||||
private static final String URL = BASE_URL + ID;
|
||||
private static StreamExtractor extractor;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() throws Exception {
|
||||
YoutubeTestsUtils.ensureStateless();
|
||||
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "noVisualMetadata"));
|
||||
extractor = YouTube.getStreamExtractor(URL);
|
||||
extractor.fetchPage();
|
||||
}
|
||||
|
||||
@Override public StreamType expectedStreamType() { return StreamType.VIDEO_STREAM; }
|
||||
@Override public String expectedUploaderName() { return "Makani"; }
|
||||
@Override public String expectedUploaderUrl() { return "https://www.youtube.com/channel/UC-iMZJ8NppwT2fLwzFWJKOQ"; }
|
||||
@Override public List<String> expectedDescriptionContains() { return Arrays.asList("Makani", "prototype", "rotors"); }
|
||||
@Override public long expectedLength() { return 175; }
|
||||
@Override public long expectedViewCountAtLeast() { return 88_000; }
|
||||
@Nullable @Override public String expectedUploadDate() { return "2017-05-16 00:00:00.000"; }
|
||||
@Nullable @Override public String expectedTextualUploadDate() { return "2017-05-16"; }
|
||||
@Override public long expectedLikeCountAtLeast() { return -1; }
|
||||
@Override public long expectedDislikeCountAtLeast() { return -1; }
|
||||
@Override public StreamExtractor extractor() { return extractor; }
|
||||
@Override public StreamingService expectedService() { return YouTube; }
|
||||
@Override public String expectedName() { return "Makani’s first commercial-scale energy kite"; }
|
||||
@Override public String expectedId() { return "An8vtD1FDqs"; }
|
||||
@Override public String expectedUrlContains() { return BASE_URL + ID; }
|
||||
@Override public String expectedOriginalUrlContains() { return URL; }
|
||||
@Override public String expectedCategory() { return "Science & Technology"; }
|
||||
@Override public String expectedLicence() { return YOUTUBE_LICENCE; }
|
||||
@Override public List<String> expectedTags() {
|
||||
return Arrays.asList("Makani", "Moonshot", "Moonshot Factory", "Prototyping",
|
||||
"california", "california wind", "clean", "clean energy", "climate change",
|
||||
"climate crisis", "energy", "energy kite", "google", "google x", "green",
|
||||
"green energy", "kite", "kite power", "kite power solutions",
|
||||
"kite power systems", "makani power", "power", "renewable", "renewable energy",
|
||||
"renewable energy engineering", "renewable energy projects",
|
||||
"renewable energy sources", "renewables", "solutions", "tech", "technology",
|
||||
"turbine", "wind", "wind energy", "wind power", "wind turbine", "windmill");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testSubscriberCount() {
|
||||
assertThrows(ParsingException.class, () -> extractor.getUploaderSubscriberCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testLikeCount() {
|
||||
assertThrows(ParsingException.class, () -> extractor.getLikeCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testUploaderAvatarUrl() {
|
||||
assertThrows(ParsingException.class, () -> extractor.getUploaderAvatarUrl());
|
||||
}
|
||||
}
|
||||
|
||||
public static class UnlistedTest {
|
||||
private static YoutubeStreamExtractor extractor;
|
||||
|
||||
|
|
Loading…
Reference in a new issue