2
0
mirror of https://github.com/TeamNewPipe/NewPipeExtractor synced 2025-09-05 00:35:11 +00:00

[YouTube] Check if channel item has subscription count in search

This commit is contained in:
Mauricio Colli
2020-03-21 03:15:23 -03:00
parent 9704fc9952
commit 9b7999fe54

View File

@@ -70,8 +70,14 @@ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor
@Override
public long getSubscriberCount() throws ParsingException {
try {
String subscribers = getTextFromObject(channelInfoItem.getObject("subscriberCountText"));
return Utils.mixedNumberWordToLong(subscribers);
final JsonObject subscriberCountObject = channelInfoItem.getObject("subscriberCountText");
if (subscriberCountObject == null) {
// Subscription count is not available for this channel item.
return -1;
}
return Utils.mixedNumberWordToLong(getTextFromObject(subscriberCountObject));
} catch (Exception e) {
throw new ParsingException("Could not get subscriber count", e);
}