[YouTube] Apply changes in extractor tests
Also remove some public test methods modifiers, add missing Test annotations on old Junit 4 tests (and update them if needed), and use final in some places where it was possible.
This commit is contained in:
parent
2c436d428c
commit
93a210394d
|
@ -2,11 +2,10 @@ package org.schabi.newpipe.extractor.services.youtube;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContains;
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContains;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEmpty;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertNotBlank;
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertNotBlank;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertTabsContain;
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertTabsContain;
|
||||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||||
|
@ -203,17 +202,13 @@ public class YoutubeChannelExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAvatarUrl() throws Exception {
|
public void testAvatars() throws Exception {
|
||||||
String avatarUrl = extractor.getAvatarUrl();
|
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||||
assertIsSecureUrl(avatarUrl);
|
|
||||||
assertContains("yt3", avatarUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBannerUrl() throws Exception {
|
public void testBanners() throws Exception {
|
||||||
String bannerUrl = extractor.getBannerUrl();
|
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||||
assertIsSecureUrl(bannerUrl);
|
|
||||||
assertContains("yt3", bannerUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -226,6 +221,7 @@ public class YoutubeChannelExtractorTest {
|
||||||
ExtractorAsserts.assertGreaterOrEqual(4_900_000, extractor.getSubscriberCount());
|
ExtractorAsserts.assertGreaterOrEqual(4_900_000, extractor.getSubscriberCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testVerified() throws Exception {
|
public void testVerified() throws Exception {
|
||||||
assertTrue(extractor.isVerified());
|
assertTrue(extractor.isVerified());
|
||||||
|
@ -248,7 +244,7 @@ public class YoutubeChannelExtractorTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Youtube RED/Premium ad blocking test
|
// YouTube RED/Premium ad blocking test
|
||||||
public static class VSauce implements BaseChannelExtractorTest {
|
public static class VSauce implements BaseChannelExtractorTest {
|
||||||
private static YoutubeChannelExtractor extractor;
|
private static YoutubeChannelExtractor extractor;
|
||||||
|
|
||||||
|
@ -300,17 +296,13 @@ public class YoutubeChannelExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAvatarUrl() throws Exception {
|
public void testAvatars() throws Exception {
|
||||||
String avatarUrl = extractor.getAvatarUrl();
|
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||||
assertIsSecureUrl(avatarUrl);
|
|
||||||
assertContains("yt3", avatarUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBannerUrl() throws Exception {
|
public void testBanners() throws Exception {
|
||||||
String bannerUrl = extractor.getBannerUrl();
|
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||||
assertIsSecureUrl(bannerUrl);
|
|
||||||
assertContains("yt3", bannerUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -400,17 +392,13 @@ public class YoutubeChannelExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAvatarUrl() throws Exception {
|
public void testAvatars() throws Exception {
|
||||||
String avatarUrl = extractor.getAvatarUrl();
|
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||||
assertIsSecureUrl(avatarUrl);
|
|
||||||
assertContains("yt3", avatarUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBannerUrl() throws Exception {
|
public void testBanners() throws Exception {
|
||||||
String bannerUrl = extractor.getBannerUrl();
|
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||||
assertIsSecureUrl(bannerUrl);
|
|
||||||
assertContains("yt3", bannerUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -524,17 +512,13 @@ public class YoutubeChannelExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAvatarUrl() throws Exception {
|
public void testAvatars() throws Exception {
|
||||||
String avatarUrl = extractor.getAvatarUrl();
|
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||||
assertIsSecureUrl(avatarUrl);
|
|
||||||
assertContains("yt3", avatarUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBannerUrl() throws Exception {
|
public void testBanners() throws Exception {
|
||||||
String bannerUrl = extractor.getBannerUrl();
|
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||||
assertIsSecureUrl(bannerUrl);
|
|
||||||
assertContains("yt3", bannerUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -621,17 +605,13 @@ public class YoutubeChannelExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAvatarUrl() throws Exception {
|
public void testAvatars() throws Exception {
|
||||||
String avatarUrl = extractor.getAvatarUrl();
|
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||||
assertIsSecureUrl(avatarUrl);
|
|
||||||
assertContains("yt3", avatarUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBannerUrl() throws Exception {
|
public void testBanners() throws Exception {
|
||||||
String bannerUrl = extractor.getBannerUrl();
|
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||||
assertIsSecureUrl(bannerUrl);
|
|
||||||
assertContains("yt3", bannerUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -689,7 +669,7 @@ public class YoutubeChannelExtractorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testName() throws Exception {
|
public void testName() throws Exception {
|
||||||
assertEquals(extractor.getName(), "Coachella");
|
assertEquals("Coachella", extractor.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -718,16 +698,14 @@ public class YoutubeChannelExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAvatarUrl() throws Exception {
|
public void testAvatars() throws Exception {
|
||||||
String avatarUrl = extractor.getAvatarUrl();
|
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||||
assertIsSecureUrl(avatarUrl);
|
|
||||||
assertContains("yt3", avatarUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBannerUrl() throws Exception {
|
public void testBanners() {
|
||||||
// CarouselHeaderRenders do not contain a banner
|
// A CarouselHeaderRenderer doesn't contain a banner
|
||||||
assertNull(extractor.getBannerUrl());
|
assertEmpty(extractor.getBanners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -795,17 +773,15 @@ public class YoutubeChannelExtractorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testAvatarUrl() throws Exception {
|
public void testAvatars() throws Exception {
|
||||||
final String avatarUrl = extractor.getAvatarUrl();
|
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||||
assertIsSecureUrl(avatarUrl);
|
|
||||||
assertContains("yt3", avatarUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testBannerUrl() throws Exception {
|
public void testBanners() throws Exception {
|
||||||
// Banners cannot be extracted from age-restricted channels
|
// Banners cannot be extracted from age-restricted channels
|
||||||
assertTrue(isNullOrEmpty(extractor.getBannerUrl()));
|
assertEmpty(extractor.getBanners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -913,18 +889,14 @@ public class YoutubeChannelExtractorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testAvatarUrl() throws Exception {
|
public void testAvatars() throws Exception {
|
||||||
final String avatarUrl = extractor.getAvatarUrl();
|
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||||
assertIsSecureUrl(avatarUrl);
|
|
||||||
assertContains("yt3", avatarUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testBannerUrl() throws Exception {
|
public void testBanners() throws Exception {
|
||||||
final String bannerUrl = extractor.getBannerUrl();
|
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||||
assertIsSecureUrl(bannerUrl);
|
|
||||||
assertContains("yt3", bannerUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class YoutubeCommentsExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetComments() throws IOException, ExtractionException {
|
void testGetComments() throws IOException, ExtractionException {
|
||||||
assertTrue(getCommentsHelper(extractor));
|
assertTrue(getCommentsHelper(extractor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,11 +66,11 @@ public class YoutubeCommentsExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
|
void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
|
||||||
assertTrue(getCommentsFromCommentsInfoHelper(url));
|
assertTrue(getCommentsFromCommentsInfoHelper(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean getCommentsFromCommentsInfoHelper(String url) throws IOException, ExtractionException {
|
private boolean getCommentsFromCommentsInfoHelper(final String url) throws IOException, ExtractionException {
|
||||||
final CommentsInfo commentsInfo = CommentsInfo.getInfo(url);
|
final CommentsInfo commentsInfo = CommentsInfo.getInfo(url);
|
||||||
|
|
||||||
assertEquals("Comments", commentsInfo.getName());
|
assertEquals("Comments", commentsInfo.getName());
|
||||||
|
@ -87,21 +87,21 @@ public class YoutubeCommentsExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCommentsAllData() throws IOException, ExtractionException {
|
void testGetCommentsAllData() throws IOException, ExtractionException {
|
||||||
InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||||
assertTrue(extractor.getCommentsCount() > 5); // at least 5 comments
|
assertTrue(extractor.getCommentsCount() > 5); // at least 5 comments
|
||||||
|
|
||||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||||
for (CommentsInfoItem c : comments.getItems()) {
|
for (final CommentsInfoItem c : comments.getItems()) {
|
||||||
assertFalse(Utils.isBlank(c.getUploaderUrl()));
|
assertFalse(Utils.isBlank(c.getUploaderUrl()));
|
||||||
assertFalse(Utils.isBlank(c.getUploaderName()));
|
assertFalse(Utils.isBlank(c.getUploaderName()));
|
||||||
assertFalse(Utils.isBlank(c.getUploaderAvatarUrl()));
|
YoutubeTestsUtils.testImages(c.getUploaderAvatars());
|
||||||
assertFalse(Utils.isBlank(c.getCommentId()));
|
assertFalse(Utils.isBlank(c.getCommentId()));
|
||||||
assertFalse(Utils.isBlank(c.getCommentText().getContent()));
|
assertFalse(Utils.isBlank(c.getCommentText().getContent()));
|
||||||
assertFalse(Utils.isBlank(c.getName()));
|
assertFalse(Utils.isBlank(c.getName()));
|
||||||
assertFalse(Utils.isBlank(c.getTextualUploadDate()));
|
assertFalse(Utils.isBlank(c.getTextualUploadDate()));
|
||||||
assertNotNull(c.getUploadDate());
|
assertNotNull(c.getUploadDate());
|
||||||
assertFalse(Utils.isBlank(c.getThumbnailUrl()));
|
YoutubeTestsUtils.testImages(c.getThumbnails());
|
||||||
assertFalse(Utils.isBlank(c.getUrl()));
|
assertFalse(Utils.isBlank(c.getUrl()));
|
||||||
assertTrue(c.getLikeCount() >= 0);
|
assertTrue(c.getLikeCount() >= 0);
|
||||||
}
|
}
|
||||||
|
@ -138,19 +138,19 @@ public class YoutubeCommentsExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCommentsAllData() throws IOException, ExtractionException {
|
void testGetCommentsAllData() throws IOException, ExtractionException {
|
||||||
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||||
|
|
||||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||||
for (CommentsInfoItem c : comments.getItems()) {
|
for (final CommentsInfoItem c : comments.getItems()) {
|
||||||
assertFalse(Utils.isBlank(c.getUploaderUrl()));
|
assertFalse(Utils.isBlank(c.getUploaderUrl()));
|
||||||
assertFalse(Utils.isBlank(c.getUploaderName()));
|
assertFalse(Utils.isBlank(c.getUploaderName()));
|
||||||
assertFalse(Utils.isBlank(c.getUploaderAvatarUrl()));
|
YoutubeTestsUtils.testImages(c.getUploaderAvatars());
|
||||||
assertFalse(Utils.isBlank(c.getCommentId()));
|
assertFalse(Utils.isBlank(c.getCommentId()));
|
||||||
assertFalse(Utils.isBlank(c.getName()));
|
assertFalse(Utils.isBlank(c.getName()));
|
||||||
assertFalse(Utils.isBlank(c.getTextualUploadDate()));
|
assertFalse(Utils.isBlank(c.getTextualUploadDate()));
|
||||||
assertNotNull(c.getUploadDate());
|
assertNotNull(c.getUploadDate());
|
||||||
assertFalse(Utils.isBlank(c.getThumbnailUrl()));
|
YoutubeTestsUtils.testImages(c.getThumbnails());
|
||||||
assertFalse(Utils.isBlank(c.getUrl()));
|
assertFalse(Utils.isBlank(c.getUrl()));
|
||||||
assertTrue(c.getLikeCount() >= 0);
|
assertTrue(c.getLikeCount() >= 0);
|
||||||
if (c.getCommentId().equals("Ugga_h1-EXdHB3gCoAEC")) { // comment without text
|
if (c.getCommentId().equals("Ugga_h1-EXdHB3gCoAEC")) { // comment without text
|
||||||
|
@ -177,22 +177,22 @@ public class YoutubeCommentsExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCommentsAllData() throws IOException, ExtractionException {
|
void testGetCommentsAllData() throws IOException, ExtractionException {
|
||||||
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||||
|
|
||||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||||
|
|
||||||
boolean heartedByUploader = false;
|
boolean heartedByUploader = false;
|
||||||
|
|
||||||
for (CommentsInfoItem c : comments.getItems()) {
|
for (final CommentsInfoItem c : comments.getItems()) {
|
||||||
assertFalse(Utils.isBlank(c.getUploaderUrl()));
|
assertFalse(Utils.isBlank(c.getUploaderUrl()));
|
||||||
assertFalse(Utils.isBlank(c.getUploaderName()));
|
assertFalse(Utils.isBlank(c.getUploaderName()));
|
||||||
assertFalse(Utils.isBlank(c.getUploaderAvatarUrl()));
|
YoutubeTestsUtils.testImages(c.getUploaderAvatars());
|
||||||
assertFalse(Utils.isBlank(c.getCommentId()));
|
assertFalse(Utils.isBlank(c.getCommentId()));
|
||||||
assertFalse(Utils.isBlank(c.getName()));
|
assertFalse(Utils.isBlank(c.getName()));
|
||||||
assertFalse(Utils.isBlank(c.getTextualUploadDate()));
|
assertFalse(Utils.isBlank(c.getTextualUploadDate()));
|
||||||
assertNotNull(c.getUploadDate());
|
assertNotNull(c.getUploadDate());
|
||||||
assertFalse(Utils.isBlank(c.getThumbnailUrl()));
|
YoutubeTestsUtils.testImages(c.getThumbnails());
|
||||||
assertFalse(Utils.isBlank(c.getUrl()));
|
assertFalse(Utils.isBlank(c.getUrl()));
|
||||||
assertTrue(c.getLikeCount() >= 0);
|
assertTrue(c.getLikeCount() >= 0);
|
||||||
assertFalse(Utils.isBlank(c.getCommentText().getContent()));
|
assertFalse(Utils.isBlank(c.getCommentText().getContent()));
|
||||||
|
@ -219,20 +219,20 @@ public class YoutubeCommentsExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCommentsAllData() throws IOException, ExtractionException {
|
void testGetCommentsAllData() throws IOException, ExtractionException {
|
||||||
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||||
|
|
||||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||||
|
|
||||||
for (CommentsInfoItem c : comments.getItems()) {
|
for (final CommentsInfoItem c : comments.getItems()) {
|
||||||
assertFalse(Utils.isBlank(c.getUploaderUrl()));
|
assertFalse(Utils.isBlank(c.getUploaderUrl()));
|
||||||
assertFalse(Utils.isBlank(c.getUploaderName()));
|
assertFalse(Utils.isBlank(c.getUploaderName()));
|
||||||
assertFalse(Utils.isBlank(c.getUploaderAvatarUrl()));
|
YoutubeTestsUtils.testImages(c.getUploaderAvatars());
|
||||||
assertFalse(Utils.isBlank(c.getCommentId()));
|
assertFalse(Utils.isBlank(c.getCommentId()));
|
||||||
assertFalse(Utils.isBlank(c.getName()));
|
assertFalse(Utils.isBlank(c.getName()));
|
||||||
assertFalse(Utils.isBlank(c.getTextualUploadDate()));
|
assertFalse(Utils.isBlank(c.getTextualUploadDate()));
|
||||||
assertNotNull(c.getUploadDate());
|
assertNotNull(c.getUploadDate());
|
||||||
assertFalse(Utils.isBlank(c.getThumbnailUrl()));
|
YoutubeTestsUtils.testImages(c.getThumbnails());
|
||||||
assertFalse(Utils.isBlank(c.getUrl()));
|
assertFalse(Utils.isBlank(c.getUrl()));
|
||||||
assertTrue(c.getLikeCount() >= 0);
|
assertTrue(c.getLikeCount() >= 0);
|
||||||
assertFalse(Utils.isBlank(c.getCommentText().getContent()));
|
assertFalse(Utils.isBlank(c.getCommentText().getContent()));
|
||||||
|
@ -260,7 +260,7 @@ public class YoutubeCommentsExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCommentsFirst() throws IOException, ExtractionException {
|
void testGetCommentsFirst() throws IOException, ExtractionException {
|
||||||
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||||
|
|
||||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||||
|
@ -293,7 +293,7 @@ public class YoutubeCommentsExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCommentsFirst() throws IOException, ExtractionException {
|
void testGetCommentsFirst() throws IOException, ExtractionException {
|
||||||
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||||
|
|
||||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||||
|
@ -319,7 +319,7 @@ public class YoutubeCommentsExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCommentsFirstReplies() throws IOException, ExtractionException {
|
void testGetCommentsFirstReplies() throws IOException, ExtractionException {
|
||||||
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||||
|
|
||||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||||
|
|
|
@ -4,7 +4,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
|
||||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.DISABLE_PRETTY_PRINT_PARAMETER;
|
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.YOUTUBEI_V1_URL;
|
||||||
|
@ -69,11 +68,10 @@ public class YoutubeMixPlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getThumbnailUrl() throws Exception {
|
void getThumbnails() throws Exception {
|
||||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||||
assertIsSecureUrl(thumbnailUrl);
|
extractor.getThumbnails().forEach(thumbnail ->
|
||||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
ExtractorAsserts.assertContains(VIDEO_ID, thumbnail.getUrl()));
|
||||||
ExtractorAsserts.assertContains(VIDEO_ID, thumbnailUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -158,11 +156,10 @@ public class YoutubeMixPlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getThumbnailUrl() throws Exception {
|
void getThumbnails() throws Exception {
|
||||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||||
assertIsSecureUrl(thumbnailUrl);
|
extractor.getThumbnails().forEach(thumbnail ->
|
||||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
ExtractorAsserts.assertContains(VIDEO_ID, thumbnail.getUrl()));
|
||||||
ExtractorAsserts.assertContains(VIDEO_ID, thumbnailUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -248,10 +245,10 @@ public class YoutubeMixPlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getThumbnailUrl() throws Exception {
|
void getThumbnails() throws Exception {
|
||||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||||
assertIsSecureUrl(thumbnailUrl);
|
extractor.getThumbnails().forEach(thumbnail ->
|
||||||
assertTrue(thumbnailUrl.startsWith("https://i.ytimg.com/vi/" + VIDEO_ID));
|
ExtractorAsserts.assertContains(VIDEO_ID, thumbnail.getUrl()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -366,10 +363,10 @@ public class YoutubeMixPlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getThumbnailUrl() throws Exception {
|
void getThumbnails() throws Exception {
|
||||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||||
assertIsSecureUrl(thumbnailUrl);
|
extractor.getThumbnails().forEach(thumbnail ->
|
||||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
ExtractorAsserts.assertContains(VIDEO_ID_OF_CHANNEL, thumbnail.getUrl()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -433,11 +430,10 @@ public class YoutubeMixPlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getThumbnailUrl() throws Exception {
|
void getThumbnails() throws Exception {
|
||||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||||
assertIsSecureUrl(thumbnailUrl);
|
extractor.getThumbnails().forEach(thumbnail ->
|
||||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
ExtractorAsserts.assertContains(VIDEO_ID, thumbnail.getUrl()));
|
||||||
ExtractorAsserts.assertContains(VIDEO_ID, thumbnailUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -523,10 +519,9 @@ public class YoutubeMixPlaylistExtractorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getThumbnailUrl() throws Exception {
|
void getThumbnailUrl() throws Exception {
|
||||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||||
assertIsSecureUrl(thumbnailUrl);
|
extractor.getThumbnails().forEach(thumbnail ->
|
||||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
ExtractorAsserts.assertContains(VIDEO_ID, thumbnail.getUrl()));
|
||||||
ExtractorAsserts.assertContains(VIDEO_ID, thumbnailUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContains;
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContains;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
|
||||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||||
import static org.schabi.newpipe.extractor.services.DefaultTests.assertNoMoreItems;
|
import static org.schabi.newpipe.extractor.services.DefaultTests.assertNoMoreItems;
|
||||||
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestGetPageInNewExtractor;
|
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestGetPageInNewExtractor;
|
||||||
|
@ -121,22 +120,17 @@ public class YoutubePlaylistExtractorTest {
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThumbnailUrl() throws Exception {
|
public void testThumbnails() throws Exception {
|
||||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||||
assertIsSecureUrl(thumbnailUrl);
|
|
||||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Disabled
|
|
||||||
@Test
|
|
||||||
public void testBannerUrl() throws ParsingException {
|
|
||||||
final String bannerUrl = extractor.getBannerUrl();
|
|
||||||
assertIsSecureUrl(bannerUrl);
|
|
||||||
ExtractorAsserts.assertContains("yt", bannerUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUploaderUrl() throws Exception {
|
public void testBanners() throws ParsingException {
|
||||||
|
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testUploaderUrl() throws Exception {
|
||||||
assertEquals("https://www.youtube.com/channel/UCs72iRpTEuwV3y6pdWYLgiw", extractor.getUploaderUrl());
|
assertEquals("https://www.youtube.com/channel/UCs72iRpTEuwV3y6pdWYLgiw", extractor.getUploaderUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,9 +141,8 @@ public class YoutubePlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUploaderAvatarUrl() throws Exception {
|
public void testUploaderAvatars() throws Exception {
|
||||||
final String uploaderAvatarUrl = extractor.getUploaderAvatarUrl();
|
YoutubeTestsUtils.testImages(extractor.getUploaderAvatars());
|
||||||
ExtractorAsserts.assertContains("yt", uploaderAvatarUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -157,6 +150,7 @@ public class YoutubePlaylistExtractorTest {
|
||||||
ExtractorAsserts.assertGreater(100, extractor.getStreamCount());
|
ExtractorAsserts.assertGreater(100, extractor.getStreamCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testUploaderVerified() throws Exception {
|
public void testUploaderVerified() throws Exception {
|
||||||
assertFalse(extractor.isUploaderVerified());
|
assertFalse(extractor.isUploaderVerified());
|
||||||
|
@ -191,7 +185,7 @@ public class YoutubePlaylistExtractorTest {
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetPageInNewExtractor() throws Exception {
|
void testGetPageInNewExtractor() throws Exception {
|
||||||
final PlaylistExtractor newExtractor = YouTube.getPlaylistExtractor(extractor.getUrl());
|
final PlaylistExtractor newExtractor = YouTube.getPlaylistExtractor(extractor.getUrl());
|
||||||
defaultTestGetPageInNewExtractor(extractor, newExtractor);
|
defaultTestGetPageInNewExtractor(extractor, newExtractor);
|
||||||
}
|
}
|
||||||
|
@ -251,22 +245,17 @@ public class YoutubePlaylistExtractorTest {
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThumbnailUrl() throws Exception {
|
public void testThumbnails() throws Exception {
|
||||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||||
assertIsSecureUrl(thumbnailUrl);
|
|
||||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Disabled
|
|
||||||
@Test
|
|
||||||
public void testBannerUrl() throws ParsingException {
|
|
||||||
final String bannerUrl = extractor.getBannerUrl();
|
|
||||||
assertIsSecureUrl(bannerUrl);
|
|
||||||
ExtractorAsserts.assertContains("yt", bannerUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUploaderUrl() throws Exception {
|
public void testBanners() throws ParsingException {
|
||||||
|
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testUploaderUrl() throws Exception {
|
||||||
assertEquals("https://www.youtube.com/channel/UCHSPWoY1J5fbDVbcnyeqwdw", extractor.getUploaderUrl());
|
assertEquals("https://www.youtube.com/channel/UCHSPWoY1J5fbDVbcnyeqwdw", extractor.getUploaderUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,9 +265,8 @@ public class YoutubePlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUploaderAvatarUrl() throws Exception {
|
public void testUploaderAvatars() throws Exception {
|
||||||
final String uploaderAvatarUrl = extractor.getUploaderAvatarUrl();
|
YoutubeTestsUtils.testImages(extractor.getUploaderAvatars());
|
||||||
ExtractorAsserts.assertContains("yt", uploaderAvatarUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -286,9 +274,10 @@ public class YoutubePlaylistExtractorTest {
|
||||||
ExtractorAsserts.assertGreater(100, extractor.getStreamCount());
|
ExtractorAsserts.assertGreater(100, extractor.getStreamCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testUploaderVerified() throws Exception {
|
public void testUploaderVerified() throws Exception {
|
||||||
assertTrue(extractor.isUploaderVerified());
|
assertFalse(extractor.isUploaderVerified());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -364,22 +353,17 @@ public class YoutubePlaylistExtractorTest {
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThumbnailUrl() throws Exception {
|
public void testThumbnails() throws Exception {
|
||||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||||
assertIsSecureUrl(thumbnailUrl);
|
|
||||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Disabled
|
|
||||||
@Test
|
|
||||||
public void testBannerUrl() throws ParsingException {
|
|
||||||
final String bannerUrl = extractor.getBannerUrl();
|
|
||||||
assertIsSecureUrl(bannerUrl);
|
|
||||||
ExtractorAsserts.assertContains("yt", bannerUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUploaderUrl() throws Exception {
|
public void testBanners() throws ParsingException {
|
||||||
|
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testUploaderUrl() throws Exception {
|
||||||
assertEquals("https://www.youtube.com/channel/UCX6b17PVsYBQ0ip5gyeme-Q", extractor.getUploaderUrl());
|
assertEquals("https://www.youtube.com/channel/UCX6b17PVsYBQ0ip5gyeme-Q", extractor.getUploaderUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,9 +374,8 @@ public class YoutubePlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUploaderAvatarUrl() throws Exception {
|
public void testUploaderAvatars() throws Exception {
|
||||||
final String uploaderAvatarUrl = extractor.getUploaderAvatarUrl();
|
YoutubeTestsUtils.testImages(extractor.getUploaderAvatars());
|
||||||
ExtractorAsserts.assertContains("yt", uploaderAvatarUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -400,9 +383,10 @@ public class YoutubePlaylistExtractorTest {
|
||||||
ExtractorAsserts.assertGreater(40, extractor.getStreamCount());
|
ExtractorAsserts.assertGreater(40, extractor.getStreamCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testUploaderVerified() throws Exception {
|
public void testUploaderVerified() throws Exception {
|
||||||
assertTrue(extractor.isUploaderVerified());
|
assertFalse(extractor.isUploaderVerified());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -480,18 +464,14 @@ public class YoutubePlaylistExtractorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testThumbnailUrl() throws Exception {
|
public void testThumbnails() throws Exception {
|
||||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||||
assertIsSecureUrl(thumbnailUrl);
|
|
||||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testBannerUrl() throws Exception {
|
public void testBanners() throws Exception {
|
||||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||||
assertIsSecureUrl(thumbnailUrl);
|
|
||||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -501,10 +481,8 @@ public class YoutubePlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Override
|
public void testUploaderAvatars() throws Exception {
|
||||||
public void testUploaderAvatarUrl() throws Exception {
|
YoutubeTestsUtils.testImages(extractor.getUploaderAvatars());
|
||||||
final String uploaderAvatarUrl = extractor.getUploaderAvatarUrl();
|
|
||||||
ExtractorAsserts.assertContains("yt", uploaderAvatarUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -540,7 +518,7 @@ public class YoutubePlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoContinuations() throws Exception {
|
void testNoContinuations() throws Exception {
|
||||||
final YoutubePlaylistExtractor extractor = (YoutubePlaylistExtractor) YouTube
|
final YoutubePlaylistExtractor extractor = (YoutubePlaylistExtractor) YouTube
|
||||||
.getPlaylistExtractor(
|
.getPlaylistExtractor(
|
||||||
"https://www.youtube.com/playlist?list=PLXJg25X-OulsVsnvZ7RVtSDW-id9_RzAO");
|
"https://www.youtube.com/playlist?list=PLXJg25X-OulsVsnvZ7RVtSDW-id9_RzAO");
|
||||||
|
@ -550,7 +528,7 @@ public class YoutubePlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOnlySingleContinuation() throws Exception {
|
void testOnlySingleContinuation() throws Exception {
|
||||||
final YoutubePlaylistExtractor extractor = (YoutubePlaylistExtractor) YouTube
|
final YoutubePlaylistExtractor extractor = (YoutubePlaylistExtractor) YouTube
|
||||||
.getPlaylistExtractor(
|
.getPlaylistExtractor(
|
||||||
"https://www.youtube.com/playlist?list=PLoumn5BIsUDeGF1vy5Nylf_RJKn5aL_nr");
|
"https://www.youtube.com/playlist?list=PLoumn5BIsUDeGF1vy5Nylf_RJKn5aL_nr");
|
||||||
|
|
|
@ -234,9 +234,9 @@ public class YoutubeSearchExtractorTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PagingTest {
|
static class PagingTest {
|
||||||
@Test
|
@Test
|
||||||
public void duplicatedItemsCheck() throws Exception {
|
void duplicatedItemsCheck() throws Exception {
|
||||||
YoutubeTestsUtils.ensureStateless();
|
YoutubeTestsUtils.ensureStateless();
|
||||||
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "paging"));
|
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "paging"));
|
||||||
final SearchExtractor extractor = YouTube.getSearchExtractor("cirque du soleil", singletonList(VIDEOS), "");
|
final SearchExtractor extractor = YouTube.getSearchExtractor("cirque du soleil", singletonList(VIDEOS), "");
|
||||||
|
@ -275,7 +275,7 @@ public class YoutubeSearchExtractorTest {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
// testMoreRelatedItems is broken because a video has no duration shown
|
// testMoreRelatedItems is broken because a video has no duration shown
|
||||||
@Override public void testMoreRelatedItems() { }
|
@Test @Override public void testMoreRelatedItems() { }
|
||||||
@Override public SearchExtractor extractor() { return extractor; }
|
@Override public SearchExtractor extractor() { return extractor; }
|
||||||
@Override public StreamingService expectedService() { return YouTube; }
|
@Override public StreamingService expectedService() { return YouTube; }
|
||||||
@Override public String expectedName() { return QUERY; }
|
@Override public String expectedName() { return QUERY; }
|
||||||
|
@ -307,7 +307,7 @@ public class YoutubeSearchExtractorTest {
|
||||||
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.CHANNEL; }
|
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.CHANNEL; }
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAtLeastOneVerified() throws IOException, ExtractionException {
|
void testAtLeastOneVerified() throws IOException, ExtractionException {
|
||||||
final List<InfoItem> items = extractor.getInitialPage().getItems();
|
final List<InfoItem> items = extractor.getInitialPage().getItems();
|
||||||
boolean verified = false;
|
boolean verified = false;
|
||||||
for (InfoItem item : items) {
|
for (InfoItem item : items) {
|
||||||
|
@ -344,11 +344,14 @@ public class YoutubeSearchExtractorTest {
|
||||||
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
|
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUploaderAvatar() throws IOException, ExtractionException {
|
void testUploaderAvatars() throws IOException, ExtractionException {
|
||||||
final List<InfoItem> items = extractor.getInitialPage().getItems();
|
extractor.getInitialPage()
|
||||||
for (final InfoItem item : items) {
|
.getItems()
|
||||||
assertNotNull(((StreamInfoItem) item).getUploaderAvatarUrl());
|
.stream()
|
||||||
}
|
.filter(StreamInfoItem.class::isInstance)
|
||||||
|
.map(StreamInfoItem.class::cast)
|
||||||
|
.forEach(streamInfoItem ->
|
||||||
|
YoutubeTestsUtils.testImages(streamInfoItem.getUploaderAvatars()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,7 +378,7 @@ public class YoutubeSearchExtractorTest {
|
||||||
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
|
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testVideoDescription() throws IOException, ExtractionException {
|
void testVideoDescription() throws IOException, ExtractionException {
|
||||||
final List<InfoItem> items = extractor.getInitialPage().getItems();
|
final List<InfoItem> items = extractor.getInitialPage().getItems();
|
||||||
assertNotNull(((StreamInfoItem) items.get(0)).getShortDescription());
|
assertNotNull(((StreamInfoItem) items.get(0)).getShortDescription());
|
||||||
}
|
}
|
||||||
|
|
|
@ -491,8 +491,8 @@ public class YoutubeStreamExtractorDefaultTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testUploaderAvatarUrl() {
|
public void testUploaderAvatars() {
|
||||||
assertThrows(ParsingException.class, () -> extractor.getUploaderAvatarUrl());
|
assertThrows(ParsingException.class, () -> extractor.getUploaderAvatars());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContains;
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContains;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
|
||||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||||
import static org.schabi.newpipe.extractor.services.youtube.stream.YoutubeStreamExtractorDefaultTest.YOUTUBE_LICENCE;
|
import static org.schabi.newpipe.extractor.services.youtube.stream.YoutubeStreamExtractorDefaultTest.YOUTUBE_LICENCE;
|
||||||
|
|
||||||
|
@ -109,7 +108,7 @@ public class YoutubeStreamExtractorRelatedMixTest extends DefaultStreamExtractor
|
||||||
assertContains(URL, streamMix.getUrl());
|
assertContains(URL, streamMix.getUrl());
|
||||||
assertContains("list=RD" + ID, streamMix.getUrl());
|
assertContains("list=RD" + ID, streamMix.getUrl());
|
||||||
assertEquals("Mix – " + TITLE, streamMix.getName());
|
assertEquals("Mix – " + TITLE, streamMix.getName());
|
||||||
assertIsSecureUrl(streamMix.getThumbnailUrl());
|
YoutubeTestsUtils.testImages(streamMix.getThumbnails());
|
||||||
|
|
||||||
final List<PlaylistInfoItem> musicMixes = playlists.stream()
|
final List<PlaylistInfoItem> musicMixes = playlists.stream()
|
||||||
.filter(item -> item.getPlaylistType().equals(PlaylistType.MIX_MUSIC))
|
.filter(item -> item.getPlaylistType().equals(PlaylistType.MIX_MUSIC))
|
||||||
|
@ -121,6 +120,6 @@ public class YoutubeStreamExtractorRelatedMixTest extends DefaultStreamExtractor
|
||||||
assertEquals(YouTube.getServiceId(), musicMix.getServiceId());
|
assertEquals(YouTube.getServiceId(), musicMix.getServiceId());
|
||||||
assertContains("list=RDCLAK", musicMix.getUrl());
|
assertContains("list=RDCLAK", musicMix.getUrl());
|
||||||
assertEquals("Hip Hop Essentials", musicMix.getName());
|
assertEquals("Hip Hop Essentials", musicMix.getName());
|
||||||
assertIsSecureUrl(musicMix.getThumbnailUrl());
|
YoutubeTestsUtils.testImages(musicMix.getThumbnails());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue