diff --git a/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java b/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java index a5f88e93..fd30356e 100644 --- a/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java @@ -15,29 +15,10 @@ public abstract class ListExtractor extends Extractor { /** * Get a new ListExtractor with the given nextStreamsUrl set. - *

- * The extractor WILL fetch the page if {@link #fetchPageUponCreation()} return true, otherwise, it will NOT. - *

- * You can call {@link #fetchPage()} later, but this is mainly used just to get more items, so we don't waste bandwidth - * downloading the whole page, but if the service that is being implemented need it, just do its own logic in {@link #fetchPageUponCreation()}. */ public ListExtractor(StreamingService service, String url, String nextStreamsUrl) throws IOException, ExtractionException { super(service, url); setNextStreamsUrl(nextStreamsUrl); - - if (fetchPageUponCreation()) { - fetchPage(); - } - } - - /** - * Decide if the page will be fetched upon creation. - *

- * The default implementation checks if the nextStreamsUrl is null or empty (indication that the caller - * don't need or know what is the next page, thus, fetch the page). - */ - protected boolean fetchPageUponCreation() { - return nextStreamsUrl == null || nextStreamsUrl.isEmpty(); } @Nonnull 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 f402a6a7..ba96b75a 100644 --- a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java +++ b/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java @@ -55,6 +55,8 @@ public class ChannelInfo extends ListInfo { } public static ChannelInfo getInfo(StreamingService service, String url) throws IOException, ExtractionException { + ChannelExtractor extractor = service.getChannelExtractor(url); + extractor.fetchPage(); return getInfo(service.getChannelExtractor(url)); } diff --git a/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskInfo.java b/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskInfo.java index b5786852..6c3e744b 100644 --- a/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskInfo.java +++ b/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskInfo.java @@ -65,13 +65,17 @@ public class KioskInfo extends ListInfo { String contentCountry) throws IOException, ExtractionException { KioskList kl = service.getKioskList(); KioskExtractor extractor = kl.getExtractorByUrl(url, null); - return getInfo(extractor, contentCountry); - } - - public static KioskInfo getInfo(KioskExtractor extractor, - String contentCountry) throws IOException, ExtractionException { extractor.setContentCountry(contentCountry); extractor.fetchPage(); + return getInfo(extractor); + } + + /** + * Get KioskInfo from KioskExtractor + * + * @param extractor an extractor where fetchPage() was already got called on. + */ + public static KioskInfo getInfo(KioskExtractor extractor) throws ExtractionException { int serviceId = extractor.getServiceId(); String name = extractor.getName(); 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 9a766fde..00d2566a 100644 --- a/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java +++ b/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java @@ -32,9 +32,16 @@ public class PlaylistInfo extends ListInfo { } public static PlaylistInfo getInfo(StreamingService service, String url) throws IOException, ExtractionException { - return getInfo(service.getPlaylistExtractor(url)); + PlaylistExtractor extractor = service.getPlaylistExtractor(url); + extractor.fetchPage(); + return getInfo(extractor); } + /** + * Get PlaylistInfo from PlaylistExtractor + * + * @param extractor an extractor where fetchPage() was already got called on. + */ public static PlaylistInfo getInfo(PlaylistExtractor extractor) throws ParsingException { int serviceId = extractor.getServiceId(); 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 d1b9ae16..86fc59e8 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 @@ -70,14 +70,6 @@ public class YoutubeChannelExtractor extends ChannelExtractor { 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; - } - @Nonnull @Override public String getCleanUrl() { 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 0bf50bbc..e6db5da9 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 @@ -23,6 +23,7 @@ public class SoundcloudChannelExtractorTest { NewPipe.init(Downloader.getInstance()); extractor = SoundCloud.getService() .getChannelExtractor("https://soundcloud.com/liluzivert"); + extractor.fetchPage(); } @Test 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 e77086ea..a1b43816 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 @@ -22,6 +22,7 @@ public class SoundcloudPlaylistExtractorTest { NewPipe.init(Downloader.getInstance()); extractor = SoundCloud.getService() .getPlaylistExtractor("https://soundcloud.com/liluzivert/sets/the-perfect-luv-tape-r"); + extractor.fetchPage(); } @Test 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 ba590109..1b15c1db 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 @@ -44,6 +44,7 @@ public class YoutubeChannelExtractorTest { NewPipe.init(Downloader.getInstance()); extractor = (YoutubeChannelExtractor) YouTube.getService() .getChannelExtractor("https://www.youtube.com/user/Gronkh"); + extractor.fetchPage(); } @Test diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java index e209eff0..a6b1b3f2 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java @@ -30,6 +30,7 @@ public class YoutubePlaylistExtractorTest { NewPipe.init(Downloader.getInstance()); extractor = (YoutubePlaylistExtractor) YouTube.getService() .getPlaylistExtractor("https://www.youtube.com/watch?v=lp-EO5I60KA&list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj"); + extractor.fetchPage(); } @Test 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 e1b75bae..a5bf18bb 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 @@ -48,6 +48,7 @@ public class YoutubeTrendingExtractorTest { extractor = (YoutubeTrendingExtractor) YouTube.getService() .getKioskList() .getExtractorById("Trending", null); + extractor.fetchPage(); } @Test