use of org.schabi.newpipe.extractor.SuggestionExtractor in project NewPipe by TeamNewPipe.
the class YoutubeSearchResultTest method setUp.
@Before
public void setUp() throws Exception {
NewPipe.init(Downloader.getInstance());
SuggestionExtractor engine = new YoutubeSuggestionExtractor(0);
suggestionReply = engine.suggestionList("hello", "de");
}
use of org.schabi.newpipe.extractor.SuggestionExtractor in project NewPipe by TeamNewPipe.
the class SuggestionSearchRunnable method run.
@Override
public void run() {
try {
SuggestionExtractor se = NewPipe.getService(serviceId).getSuggestionExtractorInstance();
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(a);
String searchLanguageKey = a.getString(R.string.search_language_key);
String searchLanguage = sp.getString(searchLanguageKey, a.getString(R.string.default_language_value));
List<String> suggestions = se.suggestionList(query, searchLanguage);
h.post(new SuggestionResultRunnable(suggestions));
} catch (ExtractionException e) {
ErrorActivity.reportError(h, a, e, null, a.findViewById(android.R.id.content), ErrorActivity.ErrorInfo.make(ErrorActivity.SEARCHED, NewPipe.getNameOfService(serviceId), query, R.string.parsing_error));
e.printStackTrace();
} catch (IOException e) {
postNewErrorToast(h, R.string.network_error);
e.printStackTrace();
} catch (Exception e) {
ErrorActivity.reportError(h, a, e, null, a.findViewById(android.R.id.content), ErrorActivity.ErrorInfo.make(ErrorActivity.SEARCHED, NewPipe.getNameOfService(serviceId), query, R.string.general_error));
}
}
Aggregations