Skip to content

Commit 0798bdd

Browse files
committed
Fix getSubscriberCount() for 0 subscribers
1 parent 8ebd971 commit 0798bdd

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,12 @@ public long getSubscriberCount() throws ParsingException {
177177
throw new ParsingException("Could not get subscriber count", e);
178178
}
179179
} else {
180-
// If the element is null, the channel have the subscriber count disabled
181-
return -1;
180+
// If there's no subscribe button, the channel has the subscriber count disabled
181+
if (initialData.getObject("header").getObject("c4TabbedHeaderRenderer").getObject("subscribeButton") == null) {
182+
return -1;
183+
} else {
184+
return 0;
185+
}
182186
}
183187
}
184188

0 commit comments

Comments
 (0)