fix exception on found ads

This commit is contained in:
Christian Schabesberger 2017-12-15 22:12:32 +01:00
parent 647605c5a6
commit d6a00228e8
2 changed files with 4 additions and 1 deletions

View File

@ -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<I extends InfoItem, E> 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);
}

View File

@ -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();
}