1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-10-25 12:27:38 +00:00

clean up downloader thing

This commit is contained in:
Christian Schabesberger
2016-09-27 22:59:04 +02:00
parent f9ac199c1f
commit 43afd5a2b8
26 changed files with 98 additions and 119 deletions

View File

@@ -4,8 +4,7 @@ import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.ChannelExtractor;
import org.schabi.newpipe.extractor.SearchEngine;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.NewPipe;
/**
* Created by Christian Schabesberger on 12.09.16.
@@ -33,7 +32,7 @@ public class YoutubeChannelExtractorTest extends AndroidTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
extractor = ServiceList.getService("Youtube")
extractor = NewPipe.getService("Youtube")
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 0, new Downloader());
}
@@ -67,13 +66,13 @@ public class YoutubeChannelExtractorTest extends AndroidTestCase {
}
public void testGetNextPage() throws Exception {
extractor = ServiceList.getService("Youtube")
extractor = NewPipe.getService("Youtube")
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 1, new Downloader());
assertTrue("next page didn't have content", !extractor.getStreams().getItemList().isEmpty());
}
public void testGetNextNextPageUrl() throws Exception {
extractor = ServiceList.getService("Youtube")
extractor = NewPipe.getService("Youtube")
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 2, new Downloader());
assertTrue("next page didn't have content", extractor.hasNextPage());
}

View File

@@ -2,15 +2,11 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.extractor.AbstractVideoInfo;
import org.schabi.newpipe.extractor.SearchResult;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamPreviewInfo;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.SearchEngine;
import org.schabi.newpipe.Downloader;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;
/**
@@ -40,7 +36,7 @@ public class YoutubeSearchEngineTest extends AndroidTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
SearchEngine engine = ServiceList.getService("Youtube")
SearchEngine engine = NewPipe.getService("Youtube")
.getSearchEngineInstance(new Downloader());
result = engine.search("this is something boring",

View File

@@ -6,7 +6,7 @@ import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.AbstractVideoInfo;
import org.schabi.newpipe.extractor.ExtractionException;
import org.schabi.newpipe.extractor.ParsingException;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamExtractor;
import org.schabi.newpipe.extractor.VideoStream;
@@ -37,7 +37,7 @@ public class YoutubeStreamExtractorDefaultTest extends AndroidTestCase {
private StreamExtractor extractor;
public void setUp() throws IOException, ExtractionException {
extractor = ServiceList.getService("Youtube")
extractor = NewPipe.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=YQHsXMglC9A", new Downloader());
}
@@ -48,7 +48,7 @@ public class YoutubeStreamExtractorDefaultTest extends AndroidTestCase {
public void testGetValidTimeStamp() throws ExtractionException, IOException {
StreamExtractor extractor =
ServiceList.getService("Youtube")
NewPipe.getService("Youtube")
.getExtractorInstance("https://youtu.be/FmG385_uUys?t=174", new Downloader());
assertTrue(Integer.toString(extractor.getTimeStamp()),
extractor.getTimeStamp() == 174);

View File

@@ -4,7 +4,7 @@ import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.ExtractionException;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.services.youtube.YoutubeStreamExtractor;
import java.io.IOException;
@@ -39,7 +39,7 @@ public class YoutubeStreamExtractorGemaTest extends AndroidTestCase {
public void testGemaError() throws IOException, ExtractionException {
if(testActive) {
try {
ServiceList.getService("Youtube")
NewPipe.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=3O1_3zBUKM8",
new Downloader());
} catch(YoutubeStreamExtractor.GemaException ge) {

View File

@@ -2,11 +2,8 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.AbstractVideoInfo;
import org.schabi.newpipe.extractor.ExtractionException;
import org.schabi.newpipe.extractor.ParsingException;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamExtractor;
import java.io.IOException;
@@ -39,7 +36,7 @@ public class YoutubeStreamExtractorLiveStreamTest extends AndroidTestCase {
public void setUp() throws IOException, ExtractionException {
//todo: make the extractor not throw over a livestream
/*
extractor = ServiceList.getService("Youtube")
extractor = NewPipe.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=J0s6NjqdjLE", new Downloader());
*/
}

View File

@@ -4,8 +4,8 @@ import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.ExtractionException;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.ParsingException;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamExtractor;
import org.schabi.newpipe.extractor.VideoStream;
@@ -16,7 +16,7 @@ public class YoutubeStreamExtractorRestrictedTest extends AndroidTestCase {
private StreamExtractor extractor;
public void setUp() throws IOException, ExtractionException {
extractor = ServiceList.getService("Youtube")
extractor = NewPipe.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=i6JTvzrpBy0",
new Downloader());
}
@@ -27,7 +27,7 @@ public class YoutubeStreamExtractorRestrictedTest extends AndroidTestCase {
}
public void testGetValidTimeStamp() throws ExtractionException, IOException {
StreamExtractor extractor=ServiceList.getService("Youtube")
StreamExtractor extractor= NewPipe.getService("Youtube")
.getExtractorInstance("https://youtu.be/FmG385_uUys?t=174",
new Downloader());
assertTrue(Integer.toString(extractor.getTimeStamp()),