From 1df3f67074b397902273f903cef05f05d473e088 Mon Sep 17 00:00:00 2001 From: Mauricio Colli Date: Tue, 26 Sep 2017 17:46:21 -0300 Subject: [PATCH] Fix YouTube's channel extractor --- .../services/youtube/YoutubeChannelExtractor.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java index 94e2d29ce..5fba35c16 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java @@ -51,6 +51,8 @@ public class YoutubeChannelExtractor extends ChannelExtractor { */ private Document nextStreamsAjax; + private boolean fetchingNextStreams; + public YoutubeChannelExtractor(StreamingService service, String url, String nextStreamsUrl) throws IOException, ExtractionException { super(service, url, nextStreamsUrl); } @@ -63,7 +65,9 @@ public class YoutubeChannelExtractor extends ChannelExtractor { String pageContent = downloader.download(channelUrl); doc = Jsoup.parse(pageContent, channelUrl); - nextStreamsUrl = getNextStreamsUrlFrom(doc); + if (!fetchingNextStreams) { + nextStreamsUrl = getNextStreamsUrlFrom(doc); + } nextStreamsAjax = null; } @@ -71,6 +75,7 @@ public class YoutubeChannelExtractor extends ChannelExtractor { protected boolean fetchPageUponCreation() { // Unfortunately, we have to fetch the page even if we are getting only next streams, // as they don't deliver enough information on their own (the channel name, for example). + fetchingNextStreams = nextStreamsUrl != null && !nextStreamsUrl.isEmpty(); return true; }