Skip to content

Commit

Permalink
Fix YouTube's channel extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciocolli committed Sep 26, 2017
1 parent 466d87c commit 1df3f67
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -63,14 +65,17 @@ public void fetchPage() throws IOException, ExtractionException {
String pageContent = downloader.download(channelUrl);
doc = Jsoup.parse(pageContent, channelUrl);

nextStreamsUrl = getNextStreamsUrlFrom(doc);
if (!fetchingNextStreams) {
nextStreamsUrl = getNextStreamsUrlFrom(doc);
}
nextStreamsAjax = null;
}

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

Expand Down

0 comments on commit 1df3f67

Please sign in to comment.