From 921bf30bb7eedbd0c92843d3471cb2c092ef4754 Mon Sep 17 00:00:00 2001 From: Mauricio Colli Date: Sat, 21 Mar 2020 03:16:33 -0300 Subject: [PATCH] [YouTube] Add check for channel items with no video count in search --- .../extractors/YoutubeChannelInfoItemExtractor.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelInfoItemExtractor.java index 15211da7e..27c082359 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelInfoItemExtractor.java @@ -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); }