From 0798bdd5cd03bb44c0593a28b9c23df472e762ef Mon Sep 17 00:00:00 2001 From: wb9688 Date: Thu, 27 Feb 2020 16:26:22 +0100 Subject: [PATCH] Fix getSubscriberCount() for 0 subscribers --- .../youtube/extractors/YoutubeChannelExtractor.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java index b6c9bb95a..2d2fe917e 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java @@ -177,8 +177,12 @@ public class YoutubeChannelExtractor extends ChannelExtractor { throw new ParsingException("Could not get subscriber count", e); } } else { - // If the element is null, the channel have the subscriber count disabled - return -1; + // If there's no subscribe button, the channel has the subscriber count disabled + if (initialData.getObject("header").getObject("c4TabbedHeaderRenderer").getObject("subscribeButton") == null) { + return -1; + } else { + return 0; + } } }