fix channel has no second page bug
This commit is contained in:
parent
fd411c17cd
commit
863bf9dc8b
1 changed files with 6 additions and 1 deletions
|
@ -327,7 +327,12 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
|
||||||
private String getNextPageUrl(Document d) throws ParsingException {
|
private String getNextPageUrl(Document d) throws ParsingException {
|
||||||
try {
|
try {
|
||||||
Element button = d.select("button[class*=\"yt-uix-load-more\"]").first();
|
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) {
|
} catch(Exception e) {
|
||||||
throw new ParsingException("could not load next page url", e);
|
throw new ParsingException("could not load next page url", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue