[YouTube] Check if channel item has subscription count in search
This commit is contained in:
parent
9704fc9952
commit
9b7999fe54
1 changed files with 8 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue