Cache getVideoTab()

This commit is contained in:
wb9688 2020-02-28 17:05:31 +01:00
parent 8bfbae904d
commit 6ba03e542b

View File

@ -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;
}
}