From 6ba03e542bac3a088787a5db556d97d6f1205dc0 Mon Sep 17 00:00:00 2001 From: wb9688 Date: Fri, 28 Feb 2020 17:05:31 +0100 Subject: [PATCH] Cache getVideoTab() --- .../services/youtube/extractors/YoutubeChannelExtractor.java | 4 ++++ 1 file changed, 4 insertions(+) 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 7b3f5b453..d82b36349 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 @@ -53,6 +53,7 @@ public class YoutubeChannelExtractor extends ChannelExtractor { /*package-private*/ static final String CHANNEL_URL_BASE = "https://www.youtube.com/channel/"; private JsonObject initialData; + private JsonObject videoTab; public YoutubeChannelExtractor(StreamingService service, ListLinkHandler linkHandler) { super(service, linkHandler); @@ -276,6 +277,8 @@ public class YoutubeChannelExtractor extends ChannelExtractor { } private JsonObject getVideoTab() throws ParsingException { + if (this.videoTab != null) return this.videoTab; + JsonArray tabs = initialData.getObject("contents").getObject("twoColumnBrowseResultsRenderer") .getArray("tabs"); JsonObject videoTab = null; @@ -301,6 +304,7 @@ public class YoutubeChannelExtractor extends ChannelExtractor { return null; } catch (Exception ignored) {} + this.videoTab = videoTab; return videoTab; } }