1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-25 12:32:31 +01:00

removed orebot/tor support

This commit is contained in:
Christian Schabesberger 2016-07-25 11:59:37 +02:00
parent e6fe1d2008
commit 1fd6685b3b
6 changed files with 10 additions and 82 deletions

View File

@ -43,11 +43,11 @@ NewPipe does not use any Google framework libraries, or the YouTube API. It only
* Open a video in Kodi * Open a video in Kodi
* Show Next/Related videos * Show Next/Related videos
* Search YouTube in a specific language * Search YouTube in a specific language
* Orbot/Tor support (no streaming yet, experimental)
* Watch age restricted material * Watch age restricted material
### Coming Features ### Coming Features
* Orbot/Tor support
* Improved Downloading * Improved Downloading
* Bookmarks * Bookmarks
* View history * View history

View File

@ -44,4 +44,5 @@ dependencies {
compile 'com.google.android.exoplayer:exoplayer:r1.5.5' compile 'com.google.android.exoplayer:exoplayer:r1.5.5'
compile 'com.google.code.gson:gson:2.4' compile 'com.google.code.gson:gson:2.4'
compile 'com.nononsenseapps:filepicker:2.0.5' compile 'com.nononsenseapps:filepicker:2.0.5'
testCompile 'junit:junit:4.12'
} }

View File

@ -38,90 +38,13 @@ public class YoutubeSearchEngineTest extends AndroidTestCase {
private List<String> suggestionReply; private List<String> suggestionReply;
@Override @Override
public void setUp() throws Exception{ public void setUp() throws Exception {
super.setUp(); super.setUp();
SearchEngine engine = ServiceList.getService("Youtube") SearchEngine engine = ServiceList.getService("Youtube")
.getSearchEngineInstance(new Downloader()); .getSearchEngineInstance(new Downloader());
result = engine.search("this is something boring", result = engine.search("this is something boring",
0, "de", new Downloader()).getSearchResult(); 0, "de", new Downloader()).getSearchResult();
suggestionReply = engine.suggestionList("hello","de",new Downloader()); 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();
} }
} }

View File

@ -41,8 +41,8 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader {
* @return the contents of the specified text file*/ * @return the contents of the specified text file*/
public String download(String siteUrl, String language) throws IOException { public String download(String siteUrl, String language) throws IOException {
URL url = new URL(siteUrl); URL url = new URL(siteUrl);
//HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
HttpsURLConnection con = NetCipher.getHttpsURLConnection(url); //HttpsURLConnection con = NetCipher.getHttpsURLConnection(url);
con.setRequestProperty("Accept-Language", language); con.setRequestProperty("Accept-Language", language);
return dl(con); return dl(con);
} }

View File

@ -1,5 +1,7 @@
package org.schabi.newpipe.extractor.services.youtube; package org.schabi.newpipe.extractor.services.youtube;
import android.util.Log;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;

View File

@ -110,11 +110,13 @@
android:summary="@string/autoplay_by_calling_app_summary" android:summary="@string/autoplay_by_calling_app_summary"
android:defaultValue="false" /> android:defaultValue="false" />
<!--
<CheckBoxPreference <CheckBoxPreference
android:key="@string/use_tor_key" android:key="@string/use_tor_key"
android:title="@string/use_tor_title" android:title="@string/use_tor_title"
android:summary="@string/use_tor_summary" android:summary="@string/use_tor_summary"
android:defaultValue="false"/> android:defaultValue="false"/>
-->
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>