Merge branch 'master' into master
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
package org.schabi.newpipe.extractor.services.youtube;
|
||||
|
||||
|
||||
/*
|
||||
* Created by Christian Schabesberger on 30.12.15.
|
||||
*
|
||||
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
|
||||
* YoutubeVideoExtractorDefault.java is part of NewPipe.
|
||||
*
|
||||
* NewPipe is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* NewPipe is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
||||
import org.schabi.newpipe.extractor.utils.Localization;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
|
||||
/**
|
||||
* Test for {@link StreamExtractor}
|
||||
*/
|
||||
public class YoutubeStreamExtractorDASHTest {
|
||||
private static StreamInfo info;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp() throws Exception {
|
||||
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
|
||||
info = StreamInfo.getInfo(YouTube, "https://www.youtube.com/watch?v=00Q4SUnVQK4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDashMpd() {
|
||||
assertTrue(info.getDashMpdUrl(),
|
||||
info.getDashMpdUrl() != null && !info.getDashMpdUrl().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegularStreams() {
|
||||
assertEquals(0, info.getAudioStreams().size());
|
||||
assertEquals(0, info.getVideoOnlyStreams().size());
|
||||
assertEquals(4, info.getVideoStreams().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSegmentedStreams() {
|
||||
assertEquals(2, info.getSegmentedAudioStreams().size());
|
||||
assertEquals(3, info.getSegmentedVideoOnlyStreams().size());
|
||||
assertEquals(0, info.getSegmentedVideoStreams().size());
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,9 @@ import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
*/
|
||||
public class YoutubeStreamExtractorDefaultTest {
|
||||
|
||||
/**
|
||||
* Test for {@link StreamExtractor}
|
||||
*/
|
||||
public static class AdeleHello {
|
||||
private static YoutubeStreamExtractor extractor;
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@ import static java.util.Collections.singletonList;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
|
||||
/**
|
||||
* Test for {@link YoutubeSearchExtractor}
|
||||
*/
|
||||
public class YoutubeSearchCountTest {
|
||||
public static class YoutubeChannelViewCountTest extends YoutubeSearchExtractorBaseTest {
|
||||
@BeforeClass
|
||||
@@ -28,7 +31,7 @@ public class YoutubeSearchCountTest {
|
||||
public void testViewCount() {
|
||||
ChannelInfoItem ci = (ChannelInfoItem) itemsPage.getItems().get(0);
|
||||
assertTrue("Count does not fit: " + Long.toString(ci.getSubscriberCount()),
|
||||
69043316 < ci.getSubscriberCount() && ci.getSubscriberCount() < 73043316);
|
||||
69043316 < ci.getSubscriberCount() && ci.getSubscriberCount() < 103043316);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,9 @@ public class YoutubeSearchExtractorDefaultTest extends YoutubeSearchExtractorBas
|
||||
|
||||
@Test
|
||||
public void testResultList_FirstElement() {
|
||||
InfoItem firstInfoItem = itemsPage.getItems().get(1);
|
||||
InfoItem firstInfoItem = itemsPage.getItems().get(0);
|
||||
if(! (firstInfoItem instanceof ChannelInfoItem))
|
||||
firstInfoItem = itemsPage.getItems().get(1);
|
||||
|
||||
// The channel should be the first item
|
||||
assertTrue(firstInfoItem instanceof ChannelInfoItem);
|
||||
|
||||
Reference in New Issue
Block a user