[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
|
@Override
|
||||||
public long getSubscriberCount() throws ParsingException {
|
public long getSubscriberCount() throws ParsingException {
|
||||||
try {
|
try {
|
||||||
String subscribers = getTextFromObject(channelInfoItem.getObject("subscriberCountText"));
|
final JsonObject subscriberCountObject = channelInfoItem.getObject("subscriberCountText");
|
||||||
return Utils.mixedNumberWordToLong(subscribers);
|
|
||||||
|
if (subscriberCountObject == null) {
|
||||||
|
// Subscription count is not available for this channel item.
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Utils.mixedNumberWordToLong(getTextFromObject(subscriberCountObject));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ParsingException("Could not get subscriber count", e);
|
throw new ParsingException("Could not get subscriber count", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue