merged upstream/dev
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package org.schabi.newpipe.extractor.services.media_ccc;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
|
||||
import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCConferenceExtractor;
|
||||
import org.schabi.newpipe.extractor.utils.Localization;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
|
||||
|
||||
/**
|
||||
* Test {@link MediaCCCConferenceExtractor}
|
||||
*/
|
||||
public class MediaCCCConferenceExtractorTest {
|
||||
private static ChannelExtractor extractor;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
NewPipe.init(Downloader.getInstance(), new Localization("en", "en_GB"));
|
||||
extractor = MediaCCC.getChannelExtractor("https://api.media.ccc.de/public/conferences/froscon2017");
|
||||
extractor.fetchPage();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testName() throws Exception {
|
||||
assertEquals("FrOSCon 2017", extractor.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUrl() throws Exception {
|
||||
assertEquals("https://api.media.ccc.de/public/conferences/froscon2017", extractor.getUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetOriginalUrl() throws Exception {
|
||||
assertEquals("https://media.ccc.de/c/froscon2017", extractor.getOriginalUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetThumbnailUrl() throws Exception {
|
||||
assertEquals("https://static.media.ccc.de/media/events/froscon/2017/logo.png", extractor.getAvatarUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetInitalPage() throws Exception {
|
||||
assertEquals(97,extractor.getInitialPage().getItems().size());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.schabi.newpipe.extractor.services.media_ccc;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
||||
import org.schabi.newpipe.extractor.kiosk.KioskExtractor;
|
||||
import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCConferenceKiosk;
|
||||
import org.schabi.newpipe.extractor.utils.Localization;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
/**
|
||||
* Test {@link MediaCCCConferenceKiosk}
|
||||
*/
|
||||
public class MediaCCCConferenceListExtractorTest {
|
||||
|
||||
private static KioskExtractor extractor;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
NewPipe.init(Downloader.getInstance(), new Localization("en", "en_GB"));
|
||||
extractor = MediaCCC.getKioskList().getDefaultKioskExtractor();
|
||||
extractor.fetchPage();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getConferencesListTest() throws Exception {
|
||||
assertTrue("returned list was to small",
|
||||
extractor.getInitialPage().getItems().size() >= 174);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void conferenceTypeTest() throws Exception {
|
||||
assertTrue(contains(extractor.getInitialPage().getItems(), "FrOSCon 2016"));
|
||||
assertTrue(contains(extractor.getInitialPage().getItems(), "ChaosWest @ 35c3"));
|
||||
assertTrue(contains(extractor.getInitialPage().getItems(), "CTreffOS chaOStalks"));
|
||||
assertTrue(contains(extractor.getInitialPage().getItems(), "Datenspuren 2015"));
|
||||
assertTrue(contains(extractor.getInitialPage().getItems(), "Chaos Singularity 2017"));
|
||||
assertTrue(contains(extractor.getInitialPage().getItems(), "SIGINT10"));
|
||||
assertTrue(contains(extractor.getInitialPage().getItems(), "Vintage Computing Festival Berlin 2015"));
|
||||
assertTrue(contains(extractor.getInitialPage().getItems(), "FIfFKon 2015"));
|
||||
assertTrue(contains(extractor.getInitialPage().getItems(), "33C3: trailers"));
|
||||
assertTrue(contains(extractor.getInitialPage().getItems(), "Blinkenlights"));
|
||||
}
|
||||
|
||||
private boolean contains(List<InfoItem> itemList, String name) {
|
||||
for(InfoItem item : itemList) {
|
||||
if(item.getName().equals(name))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.schabi.newpipe.extractor.services.media_ccc;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCStreamExtractor;
|
||||
import org.schabi.newpipe.extractor.stream.AudioStream;
|
||||
import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
||||
import org.schabi.newpipe.extractor.utils.Localization;
|
||||
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
|
||||
|
||||
/**
|
||||
* Test {@link MediaCCCStreamExtractor}
|
||||
*/
|
||||
public class MediaCCCOggTest {
|
||||
// test against https://api.media.ccc.de/public/events/1317
|
||||
private static StreamExtractor extractor;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
|
||||
|
||||
extractor = MediaCCC.getStreamExtractor("https://api.media.ccc.de/public/events/1317");
|
||||
extractor.fetchPage();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAudioStreamsCount() throws Exception {
|
||||
assertEquals(1, extractor.getAudioStreams().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAudioStreamsContainOgg() throws Exception {
|
||||
for(AudioStream stream : extractor.getAudioStreams()) {
|
||||
System.out.println(stream.getFormat());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.schabi.newpipe.extractor.services.media_ccc;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import org.schabi.newpipe.extractor.ListExtractor;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
||||
import org.schabi.newpipe.extractor.search.SearchExtractor;
|
||||
import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCSearchExtractor;
|
||||
import org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCSearchQueryHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
import org.schabi.newpipe.extractor.utils.Localization;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
|
||||
|
||||
/**
|
||||
* Test for {@link MediaCCCSearchExtractor}
|
||||
*/
|
||||
public class MediaCCCSearchExtractorAllTest {
|
||||
|
||||
private static SearchExtractor extractor;
|
||||
private static ListExtractor.InfoItemsPage<InfoItem> itemsPage;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
|
||||
extractor = MediaCCC.getSearchExtractor( new MediaCCCSearchQueryHandlerFactory()
|
||||
.fromQuery("c3", Arrays.asList(new String[0]), "")
|
||||
,new Localization("GB", "en"));
|
||||
extractor.fetchPage();
|
||||
itemsPage = extractor.getInitialPage();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIfChannelInfoItemsAvailable() {
|
||||
boolean isAvialable = false;
|
||||
for(InfoItem item : itemsPage.getItems()) {
|
||||
if(item instanceof ChannelInfoItem) {
|
||||
isAvialable = true;
|
||||
}
|
||||
}
|
||||
assertTrue("ChannelInfoItem not in all list", isAvialable);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIfStreamInfoitemsAvailable() {
|
||||
boolean isAvialable = false;
|
||||
for(InfoItem item : itemsPage.getItems()) {
|
||||
if(item instanceof StreamInfoItem) {
|
||||
isAvialable = true;
|
||||
}
|
||||
}
|
||||
assertTrue("ChannelInfoItem not in all list", isAvialable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.schabi.newpipe.extractor.services.media_ccc;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import org.schabi.newpipe.extractor.ListExtractor;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
||||
import org.schabi.newpipe.extractor.search.SearchExtractor;
|
||||
import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCSearchExtractor;
|
||||
import org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCSearchQueryHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.utils.Localization;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
|
||||
|
||||
/**
|
||||
* Test for {@link MediaCCCSearchExtractor}
|
||||
*/
|
||||
public class MediaCCCSearchExtractorConferencesTest {
|
||||
|
||||
private static SearchExtractor extractor;
|
||||
private static ListExtractor.InfoItemsPage<InfoItem> itemsPage;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
|
||||
extractor = MediaCCC.getSearchExtractor( new MediaCCCSearchQueryHandlerFactory()
|
||||
.fromQuery("c3", Arrays.asList(new String[] {"conferences"}), "")
|
||||
,new Localization("GB", "en"));
|
||||
extractor.fetchPage();
|
||||
itemsPage = extractor.getInitialPage();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReturnTypeChannel() {
|
||||
for(InfoItem item : itemsPage.getItems()) {
|
||||
assertTrue("Item is not of type channel", item instanceof ChannelInfoItem);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemCount() {
|
||||
assertTrue("Count is to hight: " + itemsPage.getItems().size(), itemsPage.getItems().size() < 127);
|
||||
assertTrue("Countis to low: " + itemsPage.getItems().size(), itemsPage.getItems().size() >= 29);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.schabi.newpipe.extractor.services.media_ccc;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import org.schabi.newpipe.extractor.ListExtractor;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.search.SearchExtractor;
|
||||
import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCSearchExtractor;
|
||||
import org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCSearchQueryHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
import org.schabi.newpipe.extractor.utils.Localization;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
|
||||
|
||||
/**
|
||||
* Test for {@link MediaCCCSearchExtractor}
|
||||
*/
|
||||
public class MediaCCCSearchExtractorEventsTest {
|
||||
private static SearchExtractor extractor;
|
||||
private static ListExtractor.InfoItemsPage<InfoItem> itemsPage;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
|
||||
extractor = MediaCCC.getSearchExtractor( new MediaCCCSearchQueryHandlerFactory()
|
||||
.fromQuery("linux", Arrays.asList(new String[] {"events"}), "")
|
||||
,new Localization("GB", "en"));
|
||||
extractor.fetchPage();
|
||||
itemsPage = extractor.getInitialPage();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCount() throws Exception {
|
||||
assertTrue(Integer.toString(itemsPage.getItems().size()),
|
||||
itemsPage.getItems().size() >= 25);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testServiceId() throws Exception {
|
||||
assertEquals(2, extractor.getServiceId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testName() throws Exception {
|
||||
assertFalse(itemsPage.getItems().get(0).getName(), itemsPage.getItems().get(0).getName().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUrl() throws Exception {
|
||||
assertTrue("Url should start with: https://api.media.ccc.de/public/events/",
|
||||
itemsPage.getItems().get(0).getUrl().startsWith("https://api.media.ccc.de/public/events/"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testThumbnailUrl() throws Exception {
|
||||
assertTrue(itemsPage.getItems().get(0).getThumbnailUrl(),
|
||||
itemsPage.getItems().get(0).getThumbnailUrl().startsWith("https://static.media.ccc.de/media/")
|
||||
&& itemsPage.getItems().get(0).getThumbnailUrl().endsWith(".jpg"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReturnTypeStream() throws Exception {
|
||||
for(InfoItem item : itemsPage.getItems()) {
|
||||
assertTrue("Item is not of type StreamInfoItem", item instanceof StreamInfoItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package org.schabi.newpipe.extractor.services.media_ccc;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.services.BaseExtractorTest;
|
||||
import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
||||
import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCStreamExtractor;
|
||||
import org.schabi.newpipe.extractor.utils.Localization;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
|
||||
|
||||
/**
|
||||
* Test {@link MediaCCCStreamExtractor}
|
||||
*/
|
||||
public class MediaCCCStreamExtractorTest implements BaseExtractorTest {
|
||||
private static StreamExtractor extractor;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
|
||||
|
||||
extractor = MediaCCC.getStreamExtractor("https://api.media.ccc.de/public/events/8afc16c2-d76a-53f6-85e4-90494665835d");
|
||||
extractor.fetchPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testServiceId() throws Exception {
|
||||
assertEquals(2, extractor.getServiceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testName() throws Exception {
|
||||
assertEquals("tmux - Warum ein schwarzes Fenster am Bildschirm reicht", extractor.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testId() throws Exception {
|
||||
assertEquals("", extractor.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testUrl() throws Exception {
|
||||
assertEquals("", extractor.getUrl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testOriginalUrl() throws Exception {
|
||||
assertEquals("", extractor.getOriginalUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testThumbnail() throws Exception {
|
||||
assertEquals("https://static.media.ccc.de/media/events/gpn/gpn18/105-hd.jpg", extractor.getThumbnailUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderName() throws Exception {
|
||||
assertEquals("gpn18", extractor.getUploaderName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderUrl() throws Exception {
|
||||
assertEquals("https://api.media.ccc.de/public/conferences/gpn18", extractor.getUploaderUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderAvatarUrl() throws Exception {
|
||||
assertEquals("https://static.media.ccc.de/media/events/gpn/gpn18/logo.png", extractor.getUploaderAvatarUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVideoStreams() throws Exception {
|
||||
assertEquals(4, extractor.getVideoStreams().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAudioStreams() throws Exception {
|
||||
assertEquals(2, extractor.getAudioStreams().size());
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,13 @@ import org.schabi.newpipe.extractor.ListExtractor;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.SoundcloudSearchExtractor;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.SoundcloudSearchQueryHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeSearchExtractor;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
import org.schabi.newpipe.extractor.utils.Localization;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
@@ -44,26 +47,20 @@ public class SoundcloudSearchExtractorDefaultTest extends SoundcloudSearchExtrac
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
|
||||
extractor = (SoundcloudSearchExtractor) SoundCloud.getSearchExtractor("lill uzi vert");
|
||||
extractor = (SoundcloudSearchExtractor) SoundCloud.getSearchExtractor(
|
||||
new SoundcloudSearchQueryHandlerFactory().fromQuery("lill uzi vert",
|
||||
Arrays.asList(new String[]{"tracks"}), ""),
|
||||
new Localization("GB", "en"));
|
||||
extractor.fetchPage();
|
||||
itemsPage = extractor.getInitialPage();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSecondPageUrl() throws Exception {
|
||||
assertEquals("https://api-v2.soundcloud.com/search?q=lill+uzi+vert&limit=10&offset=10",
|
||||
assertEquals("https://api-v2.soundcloud.com/search/tracks?q=lill+uzi+vert&limit=10&offset=10",
|
||||
removeClientId(extractor.getNextPageUrl()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResultList_FirstElement() {
|
||||
InfoItem firstInfoItem = itemsPage.getItems().get(0);
|
||||
|
||||
// THe channel should be the first item
|
||||
assertEquals("name", "Bad and Boujee (Feat. Lil Uzi Vert) [Prod. By Metro Boomin]", firstInfoItem.getName());
|
||||
assertEquals("url","https://soundcloud.com/migosatl/bad-and-boujee-feat-lil-uzi-vert-prod-by-metro-boomin", firstInfoItem.getUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResultListCheckIfContainsStreamItems() {
|
||||
boolean hasStreams = false;
|
||||
@@ -94,7 +91,7 @@ public class SoundcloudSearchExtractorDefaultTest extends SoundcloudSearchExtrac
|
||||
}
|
||||
assertFalse("First and second page are equal", equals);
|
||||
|
||||
assertEquals("https://api-v2.soundcloud.com/search?q=lill+uzi+vert&limit=10&offset=20",
|
||||
assertEquals("https://api-v2.soundcloud.com/search/tracks?q=lill+uzi+vert&limit=10&offset=20",
|
||||
removeClientId(secondPage.getNextPageUrl()));
|
||||
}
|
||||
|
||||
|
||||
@@ -106,13 +106,6 @@ public class YoutubeChannelExtractorTest {
|
||||
public void testSubscriberCount() throws Exception {
|
||||
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChannelDonation() throws Exception {
|
||||
// this needs to be ignored since wed have to upgrade channel extractor to the new yt interface
|
||||
// in order to make this work
|
||||
assertTrue(extractor.getDonationLinks().length == 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Youtube RED/Premium ad blocking test
|
||||
@@ -204,12 +197,6 @@ public class YoutubeChannelExtractorTest {
|
||||
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChannelDonation() throws Exception {
|
||||
// this needs to be ignored since wed have to upgrade channel extractor to the new yt interface
|
||||
// in order to make this work
|
||||
assertTrue(extractor.getDonationLinks().length == 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Kurzgesagt implements BaseChannelExtractorTest {
|
||||
@@ -312,11 +299,6 @@ public class YoutubeChannelExtractorTest {
|
||||
public void testSubscriberCount() throws Exception {
|
||||
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 5e6);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChannelDonation() throws Exception {
|
||||
assertTrue(extractor.getDonationLinks().length == 1);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CaptainDisillusion implements BaseChannelExtractorTest {
|
||||
@@ -501,11 +483,6 @@ public class YoutubeChannelExtractorTest {
|
||||
public void testSubscriberCount() throws Exception {
|
||||
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 50);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChannelDonation() throws Exception {
|
||||
assertTrue(extractor.getDonationLinks().length == 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ public class YoutubeStreamExtractorAgeRestrictedTest {
|
||||
s.getUrl().contains(HTTPS));
|
||||
assertTrue(s.resolution.length() > 0);
|
||||
assertTrue(Integer.toString(s.getFormatId()),
|
||||
0 <= s.getFormatId() && s.getFormatId() <= 4);
|
||||
0 <= s.getFormatId() && s.getFormatId() <= 0x100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ public class YoutubeStreamExtractorDefaultTest {
|
||||
assertIsSecureUrl(s.url);
|
||||
assertTrue(s.resolution.length() > 0);
|
||||
assertTrue(Integer.toString(s.getFormatId()),
|
||||
0 <= s.getFormatId() && s.getFormatId() <= 4);
|
||||
0 <= s.getFormatId() && s.getFormatId() <= 0x100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,9 +60,9 @@ public class YoutubeStreamLinkHandlerFactoryTest {
|
||||
public void getIdfromYt() throws Exception {
|
||||
assertEquals("jZViOEv90dI", linkHandler.fromUrl("https://www.youtube.com/watch?v=jZViOEv90dI").getId());
|
||||
assertEquals("W-fFHeTX70Q", linkHandler.fromUrl("https://www.youtube.com/watch?v=W-fFHeTX70Q").getId());
|
||||
assertEquals("jZViOEv90dI", linkHandler.fromUrl("https://www.youtube.com/watch?v=jZViOEv90dI?t=100").getId());
|
||||
assertEquals("jZViOEv90dI", linkHandler.fromUrl("https://WWW.YouTube.com/watch?v=jZViOEv90dI?t=100").getId());
|
||||
assertEquals("jZViOEv90dI", linkHandler.fromUrl("HTTPS://www.youtube.com/watch?v=jZViOEv90dI?t=100").getId());
|
||||
assertEquals("jZViOEv90dI", linkHandler.fromUrl("https://www.youtube.com/watch?v=jZViOEv90dI&t=100").getId());
|
||||
assertEquals("jZViOEv90dI", linkHandler.fromUrl("https://WWW.YouTube.com/watch?v=jZViOEv90dI&t=100").getId());
|
||||
assertEquals("jZViOEv90dI", linkHandler.fromUrl("HTTPS://www.youtube.com/watch?v=jZViOEv90dI&t=100").getId());
|
||||
assertEquals("jZViOEv90dI", linkHandler.fromUrl("https://youtu.be/jZViOEv90dI?t=9s").getId());
|
||||
assertEquals("jZViOEv90dI", linkHandler.fromUrl("HTTPS://Youtu.be/jZViOEv90dI?t=9s").getId());
|
||||
assertEquals("uEJuoEs1UxY", linkHandler.fromUrl("http://www.youtube.com/watch_popup?v=uEJuoEs1UxY").getId());
|
||||
@@ -85,9 +85,9 @@ public class YoutubeStreamLinkHandlerFactoryTest {
|
||||
@Test
|
||||
public void testAcceptYtUrl() throws ParsingException {
|
||||
assertTrue(linkHandler.acceptUrl("https://www.youtube.com/watch?v=jZViOEv90dI"));
|
||||
assertTrue(linkHandler.acceptUrl("https://www.youtube.com/watch?v=jZViOEv90dI?t=100"));
|
||||
assertTrue(linkHandler.acceptUrl("https://WWW.YouTube.com/watch?v=jZViOEv90dI?t=100"));
|
||||
assertTrue(linkHandler.acceptUrl("HTTPS://www.youtube.com/watch?v=jZViOEv90dI?t=100"));
|
||||
assertTrue(linkHandler.acceptUrl("https://www.youtube.com/watch?v=jZViOEv90dI&t=100"));
|
||||
assertTrue(linkHandler.acceptUrl("https://WWW.YouTube.com/watch?v=jZViOEv90dI&t=100"));
|
||||
assertTrue(linkHandler.acceptUrl("HTTPS://www.youtube.com/watch?v=jZViOEv90dI&t=100"));
|
||||
assertTrue(linkHandler.acceptUrl("https://youtu.be/jZViOEv90dI?t=9s"));
|
||||
assertTrue(linkHandler.acceptUrl("https://www.youtube.com/embed/jZViOEv90dI"));
|
||||
assertTrue(linkHandler.acceptUrl("https://www.youtube-nocookie.com/embed/jZViOEv90dI"));
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import org.schabi.newpipe.extractor.ListExtractor;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
||||
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeSearchExtractor;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
@@ -63,13 +64,16 @@ public class YoutubeSearchExtractorDefaultTest extends YoutubeSearchExtractorBas
|
||||
@Test
|
||||
public void testResultList_FirstElement() {
|
||||
InfoItem firstInfoItem = itemsPage.getItems().get(0);
|
||||
if(! (firstInfoItem instanceof ChannelInfoItem))
|
||||
firstInfoItem = itemsPage.getItems().get(1);
|
||||
InfoItem secondInfoItem = itemsPage.getItems().get(1);
|
||||
|
||||
InfoItem channelItem = firstInfoItem instanceof ChannelInfoItem ? firstInfoItem
|
||||
: secondInfoItem;
|
||||
|
||||
// The channel should be the first item
|
||||
assertTrue(firstInfoItem instanceof ChannelInfoItem);
|
||||
assertEquals("name", "PewDiePie", firstInfoItem.getName());
|
||||
assertEquals("url","https://www.youtube.com/user/PewDiePie", firstInfoItem.getUrl());
|
||||
assertTrue((firstInfoItem instanceof ChannelInfoItem)
|
||||
|| (secondInfoItem instanceof ChannelInfoItem));
|
||||
assertEquals("name", "PewDiePie", channelItem.getName());
|
||||
assertEquals("url","https://www.youtube.com/user/PewDiePie", channelItem.getUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user