From 51fb26625a9db58de7c7647ae4461cd3c09fe98e Mon Sep 17 00:00:00 2001 From: wb9688 Date: Mon, 24 Feb 2020 10:39:52 +0100 Subject: [PATCH] Implement getSubscriberCount() in YoutubeChannelInfoItemExtractor --- .../extractors/YoutubeChannelInfoItemExtractor.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 d987af0d..7f1e0129 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 @@ -63,9 +63,13 @@ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor } @Override - public long getSubscriberCount() { - // TODO: get subscriber count, it's in subscriberCountText.simpleText as a string like "103M subscribers" - return -1; + public long getSubscriberCount() throws ParsingException { + try { + String subscribers = channelInfoItem.getObject("subscriberCountText").getString("simpleText").split(" ")[0]; + return Utils.mixedNumberWordToLong(subscribers); + } catch (Exception e) { + throw new ParsingException("Could not get subscriber count", e); + } } @Override