Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
58bc0c17d0
11 changed files with 114 additions and 46 deletions
2
.github/ISSUE_TEMPLATE.md
vendored
2
.github/ISSUE_TEMPLATE.md
vendored
|
@ -1,2 +1,2 @@
|
||||||
- [ ] I carefully reed the [contribution guidelines](https://github.com/TeamNewPipe/NewPipe/blob/HEAD/.github/CONTRIBUTING.md) and agree to them.
|
- [ ] I carefully read the [contribution guidelines](https://github.com/TeamNewPipe/NewPipe/blob/HEAD/.github/CONTRIBUTING.md) and agree to them.
|
||||||
- [ ] I checked if the issue/feature exists in the latest version.
|
- [ ] I checked if the issue/feature exists in the latest version.
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 24
|
compileSdkVersion 25
|
||||||
buildToolsVersion '23.0.3'
|
buildToolsVersion '23.0.3'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.schabi.newpipe"
|
applicationId "org.schabi.newpipe"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 24
|
targetSdkVersion 25
|
||||||
versionCode 19
|
versionCode 19
|
||||||
versionName "0.8.5"
|
versionName "0.8.5"
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,10 @@ android {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
compile 'com.android.support:appcompat-v7:24.2.1'
|
compile 'com.android.support:appcompat-v7:25.0.0'
|
||||||
compile 'com.android.support:support-v4:24.2.1'
|
compile 'com.android.support:support-v4:25.0.0'
|
||||||
compile 'com.android.support:design:24.2.1'
|
compile 'com.android.support:design:25.0.0'
|
||||||
compile 'com.android.support:recyclerview-v7:24.2.1'
|
compile 'com.android.support:recyclerview-v7:25.0.0'
|
||||||
compile 'org.jsoup:jsoup:1.8.3'
|
compile 'org.jsoup:jsoup:1.8.3'
|
||||||
compile 'org.mozilla:rhino:1.7.7'
|
compile 'org.mozilla:rhino:1.7.7'
|
||||||
compile 'info.guardianproject.netcipher:netcipher:1.2'
|
compile 'info.guardianproject.netcipher:netcipher:1.2'
|
||||||
|
|
|
@ -3,8 +3,8 @@ package org.schabi.newpipe.extractor.youtube;
|
||||||
import android.test.AndroidTestCase;
|
import android.test.AndroidTestCase;
|
||||||
|
|
||||||
import org.schabi.newpipe.Downloader;
|
import org.schabi.newpipe.Downloader;
|
||||||
import org.schabi.newpipe.extractor.ChannelExtractor;
|
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
|
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Christian Schabesberger on 12.09.16.
|
* Created by Christian Schabesberger on 12.09.16.
|
||||||
|
@ -32,8 +32,13 @@ public class YoutubeChannelExtractorTest extends AndroidTestCase {
|
||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
NewPipe.init(new Downloader());
|
||||||
extractor = NewPipe.getService("Youtube")
|
extractor = NewPipe.getService("Youtube")
|
||||||
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 0, new Downloader());
|
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetDownloader() throws Exception {
|
||||||
|
assertNotNull(NewPipe.getDownloader());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetChannelName() throws Exception {
|
public void testGetChannelName() throws Exception {
|
||||||
|
@ -67,13 +72,13 @@ public class YoutubeChannelExtractorTest extends AndroidTestCase {
|
||||||
|
|
||||||
public void testGetNextPage() throws Exception {
|
public void testGetNextPage() throws Exception {
|
||||||
extractor = NewPipe.getService("Youtube")
|
extractor = NewPipe.getService("Youtube")
|
||||||
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 1, new Downloader());
|
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 1);
|
||||||
assertTrue("next page didn't have content", !extractor.getStreams().getItemList().isEmpty());
|
assertTrue("next page didn't have content", !extractor.getStreams().getItemList().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetNextNextPageUrl() throws Exception {
|
public void testGetNextNextPageUrl() throws Exception {
|
||||||
extractor = NewPipe.getService("Youtube")
|
extractor = NewPipe.getService("Youtube")
|
||||||
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 2, new Downloader());
|
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 2);
|
||||||
assertTrue("next page didn't have content", extractor.hasNextPage());
|
assertTrue("next page didn't have content", extractor.hasNextPage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ package org.schabi.newpipe.extractor.youtube;
|
||||||
|
|
||||||
import android.test.AndroidTestCase;
|
import android.test.AndroidTestCase;
|
||||||
|
|
||||||
import org.schabi.newpipe.extractor.SearchResult;
|
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
|
||||||
import org.schabi.newpipe.extractor.SearchEngine;
|
|
||||||
import org.schabi.newpipe.Downloader;
|
import org.schabi.newpipe.Downloader;
|
||||||
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
|
import org.schabi.newpipe.extractor.search.SearchEngine;
|
||||||
|
import org.schabi.newpipe.extractor.search.SearchResult;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -31,16 +31,26 @@ import java.util.List;
|
||||||
|
|
||||||
public class YoutubeSearchEngineTest extends AndroidTestCase {
|
public class YoutubeSearchEngineTest extends AndroidTestCase {
|
||||||
private SearchResult result;
|
private SearchResult result;
|
||||||
private List<String> suggestionReply;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
SearchEngine engine = NewPipe.getService("Youtube")
|
NewPipe.init(new Downloader());
|
||||||
.getSearchEngineInstance(new Downloader());
|
SearchEngine engine = NewPipe.getService("Youtube").getSearchEngineInstance();
|
||||||
|
|
||||||
result = engine.search("this is something boring",
|
result = engine.search("this is something boring", 0, "de").getSearchResult();
|
||||||
0, "de", new Downloader()).getSearchResult();
|
}
|
||||||
suggestionReply = engine.suggestionList("hello", "de", new Downloader());
|
|
||||||
|
public void testResultList() {
|
||||||
|
assertFalse(result.resultList.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testResultErrors() {
|
||||||
|
assertTrue(result.errors == null || result.errors.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testSuggestion() {
|
||||||
|
//todo write a real test
|
||||||
|
assertTrue(result.suggestion != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package org.schabi.newpipe.extractor.youtube;
|
||||||
|
|
||||||
|
import android.test.AndroidTestCase;
|
||||||
|
|
||||||
|
import org.schabi.newpipe.Downloader;
|
||||||
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
|
import org.schabi.newpipe.extractor.search.SuggestionExtractor;
|
||||||
|
import org.schabi.newpipe.extractor.services.youtube.YoutubeSuggestionExtractor;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Christian Schabesberger on 18.11.16.
|
||||||
|
*
|
||||||
|
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
|
||||||
|
* YoutubeSearchResultTest.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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class YoutubeSearchResultTest extends AndroidTestCase {
|
||||||
|
List<String> suggestionReply;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
NewPipe.init(new Downloader());
|
||||||
|
SuggestionExtractor engine = new YoutubeSuggestionExtractor(0);
|
||||||
|
suggestionReply = engine.suggestionList("hello", "de");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testIfSuggestions() {
|
||||||
|
assertFalse(suggestionReply.isEmpty());
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,11 +3,11 @@ package org.schabi.newpipe.extractor.youtube;
|
||||||
import android.test.AndroidTestCase;
|
import android.test.AndroidTestCase;
|
||||||
|
|
||||||
import org.schabi.newpipe.Downloader;
|
import org.schabi.newpipe.Downloader;
|
||||||
import org.schabi.newpipe.extractor.AbstractVideoInfo;
|
import org.schabi.newpipe.extractor.AbstractStreamInfo;
|
||||||
import org.schabi.newpipe.extractor.ExtractionException;
|
|
||||||
import org.schabi.newpipe.extractor.ParsingException;
|
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.StreamExtractor;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
|
import org.schabi.newpipe.extractor.stream_info.StreamExtractor;
|
||||||
import org.schabi.newpipe.extractor.stream_info.VideoStream;
|
import org.schabi.newpipe.extractor.stream_info.VideoStream;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -36,9 +36,11 @@ public class YoutubeStreamExtractorDefaultTest extends AndroidTestCase {
|
||||||
public static final String HTTPS = "https://";
|
public static final String HTTPS = "https://";
|
||||||
private StreamExtractor extractor;
|
private StreamExtractor extractor;
|
||||||
|
|
||||||
public void setUp() throws IOException, ExtractionException {
|
public void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
NewPipe.init(new Downloader());
|
||||||
extractor = NewPipe.getService("Youtube")
|
extractor = NewPipe.getService("Youtube")
|
||||||
.getExtractorInstance("https://www.youtube.com/watch?v=YQHsXMglC9A", new Downloader());
|
.getExtractorInstance("https://www.youtube.com/watch?v=YQHsXMglC9A");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetInvalidTimeStamp() throws ParsingException {
|
public void testGetInvalidTimeStamp() throws ParsingException {
|
||||||
|
@ -49,7 +51,7 @@ public class YoutubeStreamExtractorDefaultTest extends AndroidTestCase {
|
||||||
public void testGetValidTimeStamp() throws ExtractionException, IOException {
|
public void testGetValidTimeStamp() throws ExtractionException, IOException {
|
||||||
StreamExtractor extractor =
|
StreamExtractor extractor =
|
||||||
NewPipe.getService("Youtube")
|
NewPipe.getService("Youtube")
|
||||||
.getExtractorInstance("https://youtu.be/FmG385_uUys?t=174", new Downloader());
|
.getExtractorInstance("https://youtu.be/FmG385_uUys?t=174");
|
||||||
assertTrue(Integer.toString(extractor.getTimeStamp()),
|
assertTrue(Integer.toString(extractor.getTimeStamp()),
|
||||||
extractor.getTimeStamp() == 174);
|
extractor.getTimeStamp() == 174);
|
||||||
}
|
}
|
||||||
|
@ -108,7 +110,7 @@ public class YoutubeStreamExtractorDefaultTest extends AndroidTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStreamType() throws ParsingException {
|
public void testStreamType() throws ParsingException {
|
||||||
assertTrue(extractor.getStreamType() == AbstractVideoInfo.StreamType.VIDEO_STREAM);
|
assertTrue(extractor.getStreamType() == AbstractStreamInfo.StreamType.VIDEO_STREAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetDashMpd() throws ParsingException {
|
public void testGetDashMpd() throws ParsingException {
|
||||||
|
|
|
@ -3,8 +3,8 @@ package org.schabi.newpipe.extractor.youtube;
|
||||||
import android.test.AndroidTestCase;
|
import android.test.AndroidTestCase;
|
||||||
|
|
||||||
import org.schabi.newpipe.Downloader;
|
import org.schabi.newpipe.Downloader;
|
||||||
import org.schabi.newpipe.extractor.ExtractionException;
|
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.services.youtube.YoutubeStreamExtractor;
|
import org.schabi.newpipe.extractor.services.youtube.YoutubeStreamExtractor;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -39,9 +39,9 @@ public class YoutubeStreamExtractorGemaTest extends AndroidTestCase {
|
||||||
public void testGemaError() throws IOException, ExtractionException {
|
public void testGemaError() throws IOException, ExtractionException {
|
||||||
if(testActive) {
|
if(testActive) {
|
||||||
try {
|
try {
|
||||||
|
NewPipe.init(new Downloader());
|
||||||
NewPipe.getService("Youtube")
|
NewPipe.getService("Youtube")
|
||||||
.getExtractorInstance("https://www.youtube.com/watch?v=3O1_3zBUKM8",
|
.getExtractorInstance("https://www.youtube.com/watch?v=3O1_3zBUKM8");
|
||||||
new Downloader());
|
|
||||||
} catch(YoutubeStreamExtractor.GemaException ge) {
|
} catch(YoutubeStreamExtractor.GemaException ge) {
|
||||||
assertTrue(true);
|
assertTrue(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,10 @@ package org.schabi.newpipe.extractor.youtube;
|
||||||
|
|
||||||
import android.test.AndroidTestCase;
|
import android.test.AndroidTestCase;
|
||||||
|
|
||||||
import org.schabi.newpipe.extractor.ExtractionException;
|
|
||||||
import org.schabi.newpipe.extractor.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.StreamExtractor;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
|
import org.schabi.newpipe.extractor.stream_info.StreamExtractor;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -36,6 +37,8 @@ public class YoutubeStreamExtractorLiveStreamTest extends AndroidTestCase {
|
||||||
public void setUp() throws IOException, ExtractionException {
|
public void setUp() throws IOException, ExtractionException {
|
||||||
//todo: make the extractor not throw over a livestream
|
//todo: make the extractor not throw over a livestream
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
NewPipe.init(new Downloader());
|
||||||
extractor = NewPipe.getService("Youtube")
|
extractor = NewPipe.getService("Youtube")
|
||||||
.getExtractorInstance("https://www.youtube.com/watch?v=J0s6NjqdjLE", new Downloader());
|
.getExtractorInstance("https://www.youtube.com/watch?v=J0s6NjqdjLE", new Downloader());
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,10 +3,10 @@ package org.schabi.newpipe.extractor.youtube;
|
||||||
import android.test.AndroidTestCase;
|
import android.test.AndroidTestCase;
|
||||||
|
|
||||||
import org.schabi.newpipe.Downloader;
|
import org.schabi.newpipe.Downloader;
|
||||||
import org.schabi.newpipe.extractor.ExtractionException;
|
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.StreamExtractor;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
|
import org.schabi.newpipe.extractor.stream_info.StreamExtractor;
|
||||||
import org.schabi.newpipe.extractor.stream_info.VideoStream;
|
import org.schabi.newpipe.extractor.stream_info.VideoStream;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -15,10 +15,11 @@ public class YoutubeStreamExtractorRestrictedTest extends AndroidTestCase {
|
||||||
public static final String HTTPS = "https://";
|
public static final String HTTPS = "https://";
|
||||||
private StreamExtractor extractor;
|
private StreamExtractor extractor;
|
||||||
|
|
||||||
public void setUp() throws IOException, ExtractionException {
|
public void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
NewPipe.init(new Downloader());
|
||||||
extractor = NewPipe.getService("Youtube")
|
extractor = NewPipe.getService("Youtube")
|
||||||
.getExtractorInstance("https://www.youtube.com/watch?v=i6JTvzrpBy0",
|
.getExtractorInstance("https://www.youtube.com/watch?v=i6JTvzrpBy0");
|
||||||
new Downloader());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetInvalidTimeStamp() throws ParsingException {
|
public void testGetInvalidTimeStamp() throws ParsingException {
|
||||||
|
@ -28,8 +29,7 @@ public class YoutubeStreamExtractorRestrictedTest extends AndroidTestCase {
|
||||||
|
|
||||||
public void testGetValidTimeStamp() throws ExtractionException, IOException {
|
public void testGetValidTimeStamp() throws ExtractionException, IOException {
|
||||||
StreamExtractor extractor= NewPipe.getService("Youtube")
|
StreamExtractor extractor= NewPipe.getService("Youtube")
|
||||||
.getExtractorInstance("https://youtu.be/FmG385_uUys?t=174",
|
.getExtractorInstance("https://youtu.be/FmG385_uUys?t=174");
|
||||||
new Downloader());
|
|
||||||
assertTrue(Integer.toString(extractor.getTimeStamp()),
|
assertTrue(Integer.toString(extractor.getTimeStamp()),
|
||||||
extractor.getTimeStamp() == 174);
|
extractor.getTimeStamp() == 174);
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,8 @@ public class YoutubeStreamExtractorRestrictedTest extends AndroidTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetAudioStreams() throws ParsingException {
|
public void testGetAudioStreams() throws ParsingException {
|
||||||
assertTrue(!extractor.getAudioStreams().isEmpty());
|
// audiostream not always necessary
|
||||||
|
//assertTrue(!extractor.getAudioStreams().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetVideoStreams() throws ParsingException {
|
public void testGetVideoStreams() throws ParsingException {
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources></resources>
|
|
|
@ -5,7 +5,7 @@ buildscript {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.2.0'
|
classpath 'com.android.tools.build:gradle:2.2.2'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|
Loading…
Reference in a new issue