diff --git a/README.md b/README.md index 90906aefd..c76e49cff 100644 --- a/README.md +++ b/README.md @@ -43,11 +43,11 @@ NewPipe does not use any Google framework libraries, or the YouTube API. It only * Open a video in Kodi * Show Next/Related videos * Search YouTube in a specific language -* Orbot/Tor support (no streaming yet, experimental) * Watch age restricted material ### Coming Features +* Orbot/Tor support * Improved Downloading * Bookmarks * View history diff --git a/app/build.gradle b/app/build.gradle index 446ea37a1..cf45527ff 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -44,4 +44,5 @@ dependencies { compile 'com.google.android.exoplayer:exoplayer:r1.5.5' compile 'com.google.code.gson:gson:2.4' compile 'com.nononsenseapps:filepicker:2.0.5' + testCompile 'junit:junit:4.12' } diff --git a/app/src/androidTest/java/org/schabi/newpipe/extractor/youtube/YoutubeSearchEngineTest.java b/app/src/androidTest/java/org/schabi/newpipe/extractor/youtube/YoutubeSearchEngineTest.java index d24e75ec6..25d9dd810 100644 --- a/app/src/androidTest/java/org/schabi/newpipe/extractor/youtube/YoutubeSearchEngineTest.java +++ b/app/src/androidTest/java/org/schabi/newpipe/extractor/youtube/YoutubeSearchEngineTest.java @@ -38,90 +38,13 @@ public class YoutubeSearchEngineTest extends AndroidTestCase { private List suggestionReply; @Override - public void setUp() throws Exception{ + public void setUp() throws Exception { super.setUp(); SearchEngine engine = ServiceList.getService("Youtube") .getSearchEngineInstance(new Downloader()); result = engine.search("this is something boring", 0, "de", new Downloader()).getSearchResult(); - suggestionReply = engine.suggestionList("hello","de",new Downloader()); - } - - public void testIfNoErrorOccur() { - assertTrue(result.errors.isEmpty() ? "" : getStackTrace(result.errors.get(0)) - ,result.errors.isEmpty()); - } - - public void testIfListIsNotEmpty() { - assertEquals(result.resultList.size() > 0, true); - } - - public void testItemsHaveTitle() { - for(StreamPreviewInfo i : result.resultList) { - assertEquals(i.title.isEmpty(), false); - } - } - - public void testItemsHaveUploader() { - for(StreamPreviewInfo i : result.resultList) { - assertEquals(i.uploader.isEmpty(), false); - } - } - - public void testItemsHaveRightDuration() { - for(StreamPreviewInfo i : result.resultList) { - assertTrue(i.duration >= 0); - } - } - - public void testItemsHaveRightThumbnail() { - for (StreamPreviewInfo i : result.resultList) { - assertTrue(i.thumbnail_url, i.thumbnail_url.contains("https://")); - } - } - - public void testItemsHaveRightVideoUrl() { - for (StreamPreviewInfo i : result.resultList) { - assertTrue(i.webpage_url, i.webpage_url.contains("https://")); - } - } - - public void testViewCount() { - /* - for(StreamPreviewInfo i : result.resultList) { - assertTrue(Long.toString(i.view_count), i.view_count != -1); - } - */ - // that specific link used for this test, there are no videos with less - // than 10.000 views, so we can test against that. - for(StreamPreviewInfo i : result.resultList) { - assertTrue(i.title + ": " + Long.toString(i.view_count), i.view_count >= 1000); - } - } - - public void testStreamType() { - for(StreamPreviewInfo i : result.resultList) { - assertTrue("not a livestream and not a video", - i.stream_type == AbstractVideoInfo.StreamType.VIDEO_STREAM || - i.stream_type == AbstractVideoInfo.StreamType.LIVE_STREAM); - } - } - - public void testIfSuggestionsAreReplied() { - assertEquals(!suggestionReply.isEmpty(), true); - } - - public void testIfSuggestionsAreValid() { - for(String s : suggestionReply) { - assertTrue(s, !s.isEmpty()); - } - } - - private static String getStackTrace(final Throwable throwable) { - final StringWriter sw = new StringWriter(); - final PrintWriter pw = new PrintWriter(sw, true); - throwable.printStackTrace(pw); - return sw.getBuffer().toString(); + suggestionReply = engine.suggestionList("hello", "de", new Downloader()); } } diff --git a/app/src/main/java/org/schabi/newpipe/Downloader.java b/app/src/main/java/org/schabi/newpipe/Downloader.java index 607eafb6e..833891762 100644 --- a/app/src/main/java/org/schabi/newpipe/Downloader.java +++ b/app/src/main/java/org/schabi/newpipe/Downloader.java @@ -41,8 +41,8 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader { * @return the contents of the specified text file*/ public String download(String siteUrl, String language) throws IOException { URL url = new URL(siteUrl); - //HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); - HttpsURLConnection con = NetCipher.getHttpsURLConnection(url); + HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); + //HttpsURLConnection con = NetCipher.getHttpsURLConnection(url); con.setRequestProperty("Accept-Language", language); return dl(con); } diff --git a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java index f73a46640..249814248 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java @@ -1,5 +1,7 @@ package org.schabi.newpipe.extractor.services.youtube; +import android.util.Log; + import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; diff --git a/app/src/main/res/xml/settings.xml b/app/src/main/res/xml/settings.xml index f3c53ec36..0904315d0 100644 --- a/app/src/main/res/xml/settings.xml +++ b/app/src/main/res/xml/settings.xml @@ -110,11 +110,13 @@ android:summary="@string/autoplay_by_calling_app_summary" android:defaultValue="false" /> +