diff --git a/src/main/java/org/schabi/newpipe/extractor/InfoItemCollector.java b/src/main/java/org/schabi/newpipe/extractor/InfoItemCollector.java index 672eda3a5..0a0080368 100644 --- a/src/main/java/org/schabi/newpipe/extractor/InfoItemCollector.java +++ b/src/main/java/org/schabi/newpipe/extractor/InfoItemCollector.java @@ -1,5 +1,6 @@ package org.schabi.newpipe.extractor; +import org.schabi.newpipe.extractor.exceptions.FoundAdException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import java.util.ArrayList; @@ -84,6 +85,8 @@ public abstract class InfoItemCollector implements Collec public void commit(E extractor) { try { addItem(extract(extractor)); + } catch (FoundAdException ae) { + // found an ad. Maybe a debug line could be placed here } catch (ParsingException e) { addError(e); } diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineStreamTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineStreamTest.java index 55e2335f5..9ca946499 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineStreamTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineStreamTest.java @@ -47,7 +47,7 @@ public class YoutubeSearchEngineStreamTest { // Youtube will suggest "results" instead of "rsults", // keep in mind that the suggestions can change by country (the parameter "de") - result = engine.search("rsults", 0, "de", SearchEngine.Filter.STREAM) + result = engine.search("abc", 0, "de", SearchEngine.Filter.STREAM) .getSearchResult(); }