[YouTube] Add check for channel items with no video count in search

This commit is contained in:
Mauricio Colli 2020-03-21 03:16:33 -03:00
parent b7f8001a49
commit 921bf30bb7
No known key found for this signature in database
GPG Key ID: F200BFD6F29DDD85
1 changed files with 8 additions and 1 deletions

View File

@ -86,7 +86,14 @@ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor
@Override
public long getStreamCount() throws ParsingException {
try {
return Long.parseLong(Utils.removeNonDigitCharacters(getTextFromObject(channelInfoItem.getObject("videoCountText"))));
final JsonObject videoCountObject = channelInfoItem.getObject("videoCountText");
if (videoCountObject == null) {
// Video count is not available, channel probably has no public uploads.
return -1;
}
return Long.parseLong(Utils.removeNonDigitCharacters(getTextFromObject(videoCountObject)));
} catch (Exception e) {
throw new ParsingException("Could not get stream count", e);
}