improve kiosk function

improve kiosk function
This commit is contained in:
Christian Schabesberger
2017-09-23 15:47:48 +02:00
parent 82ae72900a
commit 78d461ed89
8 changed files with 144 additions and 26 deletions

View File

@@ -25,7 +25,7 @@ public class SoundcloudChartsExtractorTest {
NewPipe.init(Downloader.getInstance());
extractor = SoundCloud.getService()
.getKioskList()
.getExtractorByType("Top 50");
.getExtractorByType("Top 50", null);
extractor.fetchPage();
}

View File

@@ -12,7 +12,6 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
/*
* Created by Christian Schabesberger on 29.12.15.
*

View File

@@ -0,0 +1,58 @@
package org.schabi.newpipe.extractor.services.youtube;
/*
* Created by Christian Schabesberger on 29.12.15.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* YoutubeSearchEngineStreamTest.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.Before;
import org.junit.Test;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.kiosk.KioskList;
import org.schabi.newpipe.extractor.search.SearchEngine;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
/**
* Test for {@link YoutubeService}
*/
public class YoutubeServiceTest {
StreamingService service;
KioskList kioskList;
@Before
public void setUp() throws Exception {
NewPipe.init(Downloader.getInstance());
service = YouTube.getService();
kioskList = service.getKioskList();
}
@Test
public void testGetKioskAvailableKiosks() throws Exception {
assertFalse("No kiosk got returned", kioskList.getAvailableKisokTypes().isEmpty());
}
@Test
public void testGetDefaultKisok() throws Exception {
assertEquals(kioskList.getDefaultKioskExtractor(null).getName(), "Trending");
}
}

View File

@@ -23,13 +23,10 @@ package org.schabi.newpipe.extractor.services.youtube;
import org.junit.Before;
import org.junit.Test;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.InfoItem;
import org.schabi.newpipe.extractor.InfoItemCollector;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.kiosk.KioskExtractor;
import java.util.List;
import static junit.framework.TestCase.assertFalse;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -49,7 +46,7 @@ public class YoutubeTrendingExtractorTest {
NewPipe.init(Downloader.getInstance());
extractor = YouTube.getService()
.getKioskList()
.getExtractorByType("Trending");
.getExtractorByType("Trending", null);
extractor.fetchPage();
}