Skip to content

Commit 8ab48c6

Browse files
committed
[YouTube] Fix NPE in ChennelExtractor.getSubsciberCount()
1 parent 0710f31 commit 8ab48c6

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,12 @@ public String getFeedUrl() throws ParsingException {
140140

141141
@Override
142142
public long getSubscriberCount() throws ParsingException {
143-
final String el = doc.select("span[class*=\"yt-subscription-button-subscriber-count\"]")
144-
.first().attr("title");
143+
144+
final Element el = doc.select("span[class*=\"yt-subscription-button-subscriber-count\"]").first();
145145
if (el != null) {
146+
String elTitle = el.attr("title");
146147
try {
147-
return Utils.mixedNumberWordToLong(el);
148+
return Utils.mixedNumberWordToLong(elTitle);
148149
} catch (NumberFormatException e) {
149150
throw new ParsingException("Could not get subscriber count", e);
150151
}

0 commit comments

Comments
 (0)