[YouTube] Fix NPE in ChennelExtractor.getSubsciberCount()

This commit is contained in:
TobiGr 2019-09-25 08:56:39 +02:00
parent 0710f31a39
commit 8ab48c62b9
1 changed files with 4 additions and 3 deletions

View File

@ -140,11 +140,12 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
@Override @Override
public long getSubscriberCount() throws ParsingException { public long getSubscriberCount() throws ParsingException {
final String el = doc.select("span[class*=\"yt-subscription-button-subscriber-count\"]")
.first().attr("title"); final Element el = doc.select("span[class*=\"yt-subscription-button-subscriber-count\"]").first();
if (el != null) { if (el != null) {
String elTitle = el.attr("title");
try { try {
return Utils.mixedNumberWordToLong(el); return Utils.mixedNumberWordToLong(elTitle);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new ParsingException("Could not get subscriber count", e); throw new ParsingException("Could not get subscriber count", e);
} }