removed android code from extractor side
This commit is contained in:
parent
2318ad2bde
commit
86c36acedc
|
@ -1,8 +1,5 @@
|
||||||
package org.schabi.newpipe.extractor.services.youtube;
|
package org.schabi.newpipe.extractor.services.youtube;
|
||||||
|
|
||||||
import android.net.Uri;
|
|
||||||
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;
|
||||||
|
@ -59,6 +56,9 @@ public class YoutubeSearchEngine extends SearchEngine {
|
||||||
public StreamPreviewInfoCollector search(String query, int page, String languageCode, Downloader downloader)
|
public StreamPreviewInfoCollector search(String query, int page, String languageCode, Downloader downloader)
|
||||||
throws IOException, ExtractionException {
|
throws IOException, ExtractionException {
|
||||||
StreamPreviewInfoCollector collector = getStreamPreviewInfoCollector();
|
StreamPreviewInfoCollector collector = getStreamPreviewInfoCollector();
|
||||||
|
|
||||||
|
/* Cant use Uri.Bilder since it's android code.
|
||||||
|
// Android code is baned from the extractor side.
|
||||||
Uri.Builder builder = new Uri.Builder();
|
Uri.Builder builder = new Uri.Builder();
|
||||||
builder.scheme("https")
|
builder.scheme("https")
|
||||||
.authority("www.youtube.com")
|
.authority("www.youtube.com")
|
||||||
|
@ -66,9 +66,15 @@ public class YoutubeSearchEngine extends SearchEngine {
|
||||||
.appendQueryParameter("search_query", query)
|
.appendQueryParameter("search_query", query)
|
||||||
.appendQueryParameter("page", Integer.toString(page))
|
.appendQueryParameter("page", Integer.toString(page))
|
||||||
.appendQueryParameter("filters", "video");
|
.appendQueryParameter("filters", "video");
|
||||||
|
*/
|
||||||
|
|
||||||
|
String url = "https://www.youtube.com/results"
|
||||||
|
+ "?search_query=" + query
|
||||||
|
+ "&page=" + Integer.toString(page)
|
||||||
|
+ "&filters=" + "video";
|
||||||
|
|
||||||
String site;
|
String site;
|
||||||
String url = builder.build().toString();
|
//String url = builder.build().toString();
|
||||||
//if we've been passed a valid language code, append it to the URL
|
//if we've been passed a valid language code, append it to the URL
|
||||||
if(!languageCode.isEmpty()) {
|
if(!languageCode.isEmpty()) {
|
||||||
//assert Pattern.matches("[a-z]{2}(-([A-Z]{2}|[0-9]{1,3}))?", languageCode);
|
//assert Pattern.matches("[a-z]{2}(-([A-Z]{2}|[0-9]{1,3}))?", languageCode);
|
||||||
|
@ -125,6 +131,8 @@ public class YoutubeSearchEngine extends SearchEngine {
|
||||||
|
|
||||||
ArrayList<String> suggestions = new ArrayList<>();
|
ArrayList<String> suggestions = new ArrayList<>();
|
||||||
|
|
||||||
|
/* Cant use Uri.Bilder since it's android code.
|
||||||
|
// Android code is baned from the extractor side.
|
||||||
Uri.Builder builder = new Uri.Builder();
|
Uri.Builder builder = new Uri.Builder();
|
||||||
builder.scheme("https")
|
builder.scheme("https")
|
||||||
.authority("suggestqueries.google.com")
|
.authority("suggestqueries.google.com")
|
||||||
|
@ -135,7 +143,13 @@ public class YoutubeSearchEngine extends SearchEngine {
|
||||||
.appendQueryParameter("ds", "yt")
|
.appendQueryParameter("ds", "yt")
|
||||||
.appendQueryParameter("hl",contentCountry)
|
.appendQueryParameter("hl",contentCountry)
|
||||||
.appendQueryParameter("q", query);
|
.appendQueryParameter("q", query);
|
||||||
String url = builder.build().toString();
|
*/
|
||||||
|
String url = "https://suggestqueries.google.com/complete/search"
|
||||||
|
+ "?client=" + ""
|
||||||
|
+ "&output=" + "toolbar"
|
||||||
|
+ "&ds=" + "yt"
|
||||||
|
+ "&hl=" + contentCountry
|
||||||
|
+ "&q=" + query;
|
||||||
|
|
||||||
|
|
||||||
String response = dl.download(url);
|
String response = dl.download(url);
|
||||||
|
|
Loading…
Reference in New Issue