Skip to content

Commit 921bf30

Browse files
committed
[YouTube] Add check for channel items with no video count in search
1 parent b7f8001 commit 921bf30

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelInfoItemExtractor.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,14 @@ public long getSubscriberCount() throws ParsingException {
8686
@Override
8787
public long getStreamCount() throws ParsingException {
8888
try {
89-
return Long.parseLong(Utils.removeNonDigitCharacters(getTextFromObject(channelInfoItem.getObject("videoCountText"))));
89+
final JsonObject videoCountObject = channelInfoItem.getObject("videoCountText");
90+
91+
if (videoCountObject == null) {
92+
// Video count is not available, channel probably has no public uploads.
93+
return -1;
94+
}
95+
96+
return Long.parseLong(Utils.removeNonDigitCharacters(getTextFromObject(videoCountObject)));
9097
} catch (Exception e) {
9198
throw new ParsingException("Could not get stream count", e);
9299
}

0 commit comments

Comments
 (0)