diff --git a/src/main/java/org/schabi/newpipe/extractor/search/SearchResult.java b/src/main/java/org/schabi/newpipe/extractor/search/SearchResult.java index 2b2618e35..3effd29d4 100644 --- a/src/main/java/org/schabi/newpipe/extractor/search/SearchResult.java +++ b/src/main/java/org/schabi/newpipe/extractor/search/SearchResult.java @@ -44,23 +44,10 @@ public class SearchResult { this.errors = Collections.unmodifiableList(new ArrayList<>(errors)); } - public static SearchResult getSearchResult(SearchEngine engine, String query, int page, String languageCode, SearchEngine.Filter filter) + public static SearchResult getSearchResult(@Nonnull final SearchEngine engine, final String query, final int page, + final String languageCode, final SearchEngine.Filter filter) throws IOException, ExtractionException { - - SearchResult result = engine - .search(query, page, languageCode, filter) - .getSearchResult(); - if (result.resultList.isEmpty()) { - if (result.suggestion.isEmpty()) { - if (result.errors.isEmpty()) { - throw new ExtractionException("Empty result despite no error"); - } - } else { - // This is used as a fallback. Do not relay on it !!! - throw new SearchEngine.NothingFoundException(result.suggestion); - } - } - return result; + return engine.search(query, page, languageCode, filter).getSearchResult(); } public String getSuggestion() { diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java index a3896a678..91d43b79a 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java @@ -458,11 +458,9 @@ public class YoutubeStreamExtractor extends StreamExtractor { @Override public StreamType getStreamType() throws ParsingException { assertPageFetched(); - if (playerArgs == null) return StreamType.NONE; - try { - if (playerArgs.has("ps") && playerArgs.get("ps").toString().equals("live") || - playerArgs.get(URL_ENCODED_FMT_STREAM_MAP).toString().isEmpty()) { + if (playerArgs != null && (playerArgs.has("ps") && playerArgs.get("ps").toString().equals("live") || + playerArgs.get(URL_ENCODED_FMT_STREAM_MAP).toString().isEmpty())) { return StreamType.LIVE_STREAM; } } catch (Exception e) {