[YouTube] Fix NPE in ChennelExtractor.getSubsciberCount()
This commit is contained in:
parent
0710f31a39
commit
8ab48c62b9
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue