diff --git a/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java b/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java index fbe06460f..253444451 100644 --- a/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java @@ -65,7 +65,7 @@ public abstract class ListExtractor extends Extractor { return nextPageUrl != null && !nextPageUrl.isEmpty(); } - public List getNextItemsList() { + public List getItemsList() { return infoItemList; } diff --git a/src/main/java/org/schabi/newpipe/extractor/ListInfo.java b/src/main/java/org/schabi/newpipe/extractor/ListInfo.java index f99ba4ba4..a8e391206 100644 --- a/src/main/java/org/schabi/newpipe/extractor/ListInfo.java +++ b/src/main/java/org/schabi/newpipe/extractor/ListInfo.java @@ -4,8 +4,7 @@ import java.util.List; public abstract class ListInfo extends Info { public List related_streams; - public boolean has_more_streams; - public String next_streams_url; + public String nextPageUrl = null; public ListInfo(int serviceId, String id, String url, String name) { super(serviceId, id, url, name); @@ -20,18 +19,14 @@ public abstract class ListInfo extends Info { } public boolean hasNextPage() { - return has_more_streams; - } - - public void setHasMoreStreams(boolean has_more_streams) { - this.has_more_streams = has_more_streams; + return nextPageUrl != null && !nextPageUrl.isEmpty(); } public String getNextPageUrl() { - return next_streams_url; + return nextPageUrl; } - public void setNextStreamsUrl(String next_streams_url) { - this.next_streams_url = next_streams_url; + public void setNextPageUrl(String pageUrl) { + this.nextPageUrl = pageUrl; } } diff --git a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java b/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java index 0253ca99a..3a824faf6 100644 --- a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java +++ b/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java @@ -92,8 +92,7 @@ public class ChannelInfo extends ListInfo { info.addError(e); } - info.setHasMoreStreams(extractor.hasNextPage()); - info.setNextStreamsUrl(extractor.getNextPageUrl()); + info.setNextPageUrl(extractor.getNextPageUrl()); return info; } diff --git a/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java b/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java index d05c46b2e..1fc940f4c 100644 --- a/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java +++ b/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java @@ -75,8 +75,7 @@ public class PlaylistInfo extends ListInfo { } info.setRelatedStreams(getInfoItemsOrLogError(info, extractor)); - info.setHasMoreStreams(extractor.hasNextPage()); - info.setNextStreamsUrl(extractor.getNextPageUrl()); + info.setNextPageUrl(extractor.getNextPageUrl()); return info; } 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 d4c50fe93..fbf25cd33 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 @@ -47,18 +47,6 @@ public class YoutubeChannelExtractor extends ChannelExtractor { private static final String CHANNEL_URL_PARAMETERS = "/videos?view=0&flow=list&sort=dd&live_view=10000"; private Document doc; - /** - * It's lazily initialized (when getInfoItemPage is called) - */ - // private Document nextStreamsAjax; - - /** - * Unfortunately, we have to fetch the page even if we are only getting next streams, - * as they don't deliver enough information on their own (the channel name, for example). - *
- * This help us to keep track on what are we fetching. - */ - //private boolean fetchingNextStreams; public YoutubeChannelExtractor(StreamingService service, String url) { super(service, url); @@ -70,7 +58,6 @@ public class YoutubeChannelExtractor extends ChannelExtractor { String pageContent = downloader.download(channelUrl); doc = Jsoup.parse(pageContent, channelUrl); - //nextStreamsAjax = null; } @Override diff --git a/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java b/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java index 560b08061..465bcf0e8 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java @@ -70,7 +70,12 @@ public class SoundcloudChannelExtractorTest { } @Test - public void testGetNextStreams() throws Exception { + public void testGetNextPageUrl() throws Exception { + assertTrue(extractor.hasNextPage()); + } + + @Test + public void testGetPage() throws Exception { // Setup the streams extractor.getStreams(); ListExtractor.InfoItemPage nextItemsResult = extractor.getPage(extractor.getNextPageUrl()); diff --git a/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractorTest.java b/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractorTest.java index dba57aeb6..fb084f360 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractorTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractorTest.java @@ -74,7 +74,12 @@ public class SoundcloudChartsExtractorTest { } @Test - public void testGetNextStreams() throws Exception { + public void testGetNextPageUrl() throws Exception { + assertTrue(extractor.hasNextPage()); + } + + @Test + public void testGetNextPage() throws Exception { extractor.getInfoItems(); assertFalse("extractor has next streams", extractor.getPage(extractor.getNextPageUrl()) == null || extractor.getPage(extractor.getNextPageUrl()).infoItemList.isEmpty()); diff --git a/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractorTest.java b/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractorTest.java index 600b0d052..f6b0d59d1 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractorTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractorTest.java @@ -85,7 +85,7 @@ public class SoundcloudPlaylistExtractorTest { } @Test(expected = ExtractionException.class) - public void testGetNextStreamsNonExistent() throws Exception { + public void testGetNextPageNonExistent() throws Exception { // Setup the streams extractor.getStreams(); diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java index 2cb0fcffe..9fcdcf06f 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java @@ -109,7 +109,12 @@ public class YoutubeChannelExtractorTest { } @Test - public void testGetNextStreams() throws Exception { + public void testGetNextPageUrl() throws Exception { + assertTrue(extractor.hasNextPage()); + } + + @Test + public void testGetPage() throws Exception { // Setup the streams extractor.getStreams(); ListExtractor.InfoItemPage nextItemsResult = extractor.getPage(extractor.getNextPageUrl()); diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractorTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractorTest.java index dc032b5c0..760e14e45 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractorTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractorTest.java @@ -84,13 +84,13 @@ public class YoutubeTrendingExtractorTest { } @Test - public void testGetNextStreams() throws Exception { + public void testGetNextPage() { assertTrue("extractor has next streams", extractor.getPage(extractor.getNextPageUrl()) == null - || extractor.getPage(extractor.getNextPageUrl()).getNextItemsList().isEmpty()); + || extractor.getPage(extractor.getNextPageUrl()).getItemsList().isEmpty()); } @Test - public void testGetCleanUrl() throws Exception { + public void testGetCleanUrl() { assertEquals(extractor.getCleanUrl(), extractor.getCleanUrl(), "https://www.youtube.com/feed/trending"); } }