locate fix
This commit is contained in:
parent
91aa52f65c
commit
df4cb9e8f6
|
@ -1,9 +1,10 @@
|
|||
package org.schabi.newpipe.extractor;
|
||||
|
||||
import android.content.Context;
|
||||
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/*
|
||||
* Created by Christian Schabesberger on 28.01.16.
|
||||
|
@ -58,4 +59,20 @@ public interface Downloader {
|
|||
* @throws IOException
|
||||
*/
|
||||
String download(String siteUrl) throws IOException, ReCaptchaException;
|
||||
|
||||
/**
|
||||
* Define the language for HTTP requests and which locale variant is preferred.
|
||||
*
|
||||
* @param ctx Android application context to obtain the language.
|
||||
* If this parameter is NULL, the device country/language will be used.
|
||||
* @param defaultCountry Default country code to be used if not possible
|
||||
* determine the device country code. This parameter can be NULL.
|
||||
*/
|
||||
void initLanguageFromContext(@Nullable Context ctx, @Nullable String defaultCountry);
|
||||
|
||||
/**
|
||||
* Gets the used language in HTTP requests
|
||||
* @return the language code
|
||||
*/
|
||||
String getLanguageCode();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.schabi.newpipe.extractor.search.SearchEngine;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -43,7 +44,7 @@ public class YoutubeSearchEngine extends SearchEngine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public InfoItemsSearchCollector search(String query, int page, String languageCode, Filter filter)
|
||||
public InfoItemsSearchCollector search(String query, int page, @Nullable String contentCountry, Filter filter)
|
||||
throws IOException, ExtractionException {
|
||||
InfoItemsSearchCollector collector = getInfoItemSearchCollector();
|
||||
Downloader downloader = NewPipe.getDownloader();
|
||||
|
@ -68,15 +69,10 @@ public class YoutubeSearchEngine extends SearchEngine {
|
|||
break;
|
||||
}
|
||||
|
||||
String site;
|
||||
|
||||
//String url = builder.build().toString();
|
||||
//if we've been passed a valid language code, append it to the URL
|
||||
if (!languageCode.isEmpty()) {
|
||||
//assert Pattern.matches("[a-z]{2}(-([A-Z]{2}|[0-9]{1,3}))?", languageCode);
|
||||
site = downloader.download(url, languageCode);
|
||||
} else {
|
||||
site = downloader.download(url);
|
||||
}
|
||||
String site= downloader.download(url);
|
||||
|
||||
|
||||
Document doc = Jsoup.parse(site, url);
|
||||
Element list = doc.select("ol[class=\"item-section\"]").first();
|
||||
|
|
Loading…
Reference in New Issue