fix channel has no second page bug

pull/364/head
Christian Schabesberger 2016-09-14 11:15:08 +02:00
rodzic fd411c17cd
commit 863bf9dc8b
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -327,7 +327,12 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
private String getNextPageUrl(Document d) throws ParsingException {
try {
Element button = d.select("button[class*=\"yt-uix-load-more\"]").first();
return button.attr("abs:data-uix-load-more-href");
if(button != null) {
return button.attr("abs:data-uix-load-more-href");
} else {
// sometimes channels are simply so small, they don't have a second/next4q page
return "";
}
} catch(Exception e) {
throw new ParsingException("could not load next page url", e);
}