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

pull/296/head
Mauricio Colli 2020-03-21 03:16:33 -03:00
rodzic b7f8001a49
commit 921bf30bb7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: F200BFD6F29DDD85
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -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);
}