mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-21 18:42:35 +01:00
minor commit:
-removed now-redundant language code check
This commit is contained in:
parent
9e7d9ee973
commit
27b450f1e3
@ -94,9 +94,9 @@ public class VideoItemListFragment extends ListFragment {
|
||||
try {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
String searchLanguageKey = getContext().getString(R.string.searchLanguage);
|
||||
String searchLanguage = sp.getString(searchLanguageKey, "");
|
||||
String searchLanguage = sp.getString(searchLanguageKey, "en");
|
||||
SearchEngine.Result result = engine.search(query, page, searchLanguage);
|
||||
Log.i(TAG, "countryCode passed:\""+searchLanguage+"\"");
|
||||
Log.i(TAG, "language code passed:\""+searchLanguage+"\"");
|
||||
if(run) {
|
||||
h.post(new ResultRunnable(result, requestId));
|
||||
}
|
||||
|
@ -61,23 +61,17 @@ public class YoutubeSearchEngine implements SearchEngine {
|
||||
|
||||
String site;
|
||||
String url = builder.build().toString();
|
||||
//if we've been passed a valid, non-empty language code, append it to the URL
|
||||
//if we've been passed a valid language code, append it to the URL
|
||||
if(languageCode.length() > 0) {
|
||||
if(languageCode.length() == 2) {
|
||||
//assert Pattern.matches("[a-z]{2}(-([A-Z]{2}|[0-9]{1,3}))?", languageCode);
|
||||
Log.i(TAG, "URI: \""+builder+"\"");
|
||||
site = Downloader.download(url, languageCode);
|
||||
}
|
||||
else {
|
||||
Log.e(TAG, "invalid language code passed to search(): \""+languageCode+"\"");
|
||||
site = Downloader.download(url);
|
||||
}
|
||||
}
|
||||
else {
|
||||
site = Downloader.download(url);
|
||||
}
|
||||
|
||||
|
||||
//String site = Downloader.download(url);
|
||||
Document doc = Jsoup.parse(site, url);
|
||||
Result result = new Result();
|
||||
Element list = doc.select("ol[class=\"item-section\"]").first();
|
||||
|
@ -51,13 +51,11 @@
|
||||
android:title="@string/showNextAndSimilarTitle"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<!-- This function is not yet available
|
||||
<ListPreference
|
||||
android:key="@string/searchLanguage"
|
||||
android:title="@string/searchLanguageTitle"
|
||||
android:entries="@array/languageNames"
|
||||
android:entryValues="@array/languageCodes"
|
||||
android:defaultValue="en" />
|
||||
|
||||
-->
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user