diff --git a/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java b/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java index fad9589ef..a5f88e93e 100644 --- a/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java @@ -3,6 +3,7 @@ package org.schabi.newpipe.extractor; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.stream.StreamInfoItemCollector; +import javax.annotation.Nonnull; import java.io.IOException; import java.util.List; @@ -39,7 +40,9 @@ public abstract class ListExtractor extends Extractor { return nextStreamsUrl == null || nextStreamsUrl.isEmpty(); } + @Nonnull public abstract StreamInfoItemCollector getStreams() throws IOException, ExtractionException; + public abstract NextItemsResult getNextStreams() throws IOException, ExtractionException; public boolean hasMoreStreams() { diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java index b54febae8..845d77217 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java @@ -86,6 +86,7 @@ public class SoundcloudChannelExtractor extends ChannelExtractor { return user.getString("description", ""); } + @Nonnull @Override public StreamInfoItemCollector getStreams() throws IOException, ExtractionException { StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId()); diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractor.java index c7a1e6ff2..24e51b1ac 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractor.java @@ -50,6 +50,7 @@ public class SoundcloudChartsExtractor extends KioskExtractor { return new NextItemsResult(collector, nextStreamsUrl); } + @Nonnull @Override public StreamInfoItemCollector getStreams() throws IOException, ExtractionException { StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId()); diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractor.java index df2b5bd51..3f51be7c3 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractor.java @@ -88,6 +88,7 @@ public class SoundcloudPlaylistExtractor extends PlaylistExtractor { return playlist.getNumber("track_count", 0).longValue(); } + @Nonnull @Override public StreamInfoItemCollector getStreams() throws IOException, ExtractionException { StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId()); diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java index a01ec1792..c4a42414b 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java @@ -71,7 +71,7 @@ public class SoundcloudStreamExtractor extends StreamExtractor { @Override public int getAgeLimit() { - return 0; + return NO_AGE_LIMIT; } @Override 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 b2178baac..75b31e037 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 @@ -163,6 +163,7 @@ public class YoutubeChannelExtractor extends ChannelExtractor { } } + @Nonnull @Override public StreamInfoItemCollector getStreams() throws IOException, ExtractionException { StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId()); diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractor.java index de3b485b9..bf2c1ee1f 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractor.java @@ -143,6 +143,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor { } } + @Nonnull @Override public StreamInfoItemCollector getStreams() throws IOException, ExtractionException { StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId()); diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java index cefd7e783..c7e96a2f1 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java @@ -167,7 +167,7 @@ public class YoutubeStreamExtractor extends StreamExtractor { @Override public int getAgeLimit() throws ParsingException { if (!isAgeRestricted) { - return 0; + return NO_AGE_LIMIT; } try { return Integer.valueOf(doc.select("meta[property=\"og:restrictions:age\"]") diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractor.java index 73ab3f297..9f859123d 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractor.java @@ -79,6 +79,7 @@ public class YoutubeTrendingExtractor extends KioskExtractor { } } + @Nonnull @Override public StreamInfoItemCollector getStreams() throws ParsingException { StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId()); diff --git a/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java b/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java index 3a10f80da..f77fcbc80 100644 --- a/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java @@ -39,6 +39,8 @@ import java.util.List; */ public abstract class StreamExtractor extends Extractor { + public static final int NO_AGE_LIMIT = 0; + public StreamExtractor(StreamingService service, String url) throws IOException, ExtractionException { super(service, url); }