[StreamExtractor] Deduplicated a ton of code by using default methods
This commit is contained in:
parent
15b98ffdb4
commit
1e2e0029fc
|
@ -149,27 +149,24 @@ public class BandcampRadioStreamExtractor extends BandcampStreamExtractor {
|
|||
@Nonnull
|
||||
@Override
|
||||
public String getLicence() {
|
||||
// Contrary to other Bandcamp streams, radio streams don't have a license
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getCategory() {
|
||||
// Contrary to other Bandcamp streams, radio streams don't have categories
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<String> getTags() {
|
||||
// Contrary to other Bandcamp streams, radio streams don't have tags
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Privacy getPrivacy() {
|
||||
return Privacy.PUBLIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlaylistInfoItemsCollector getRelatedItems() {
|
||||
// Contrary to other Bandcamp streams, radio streams don't have related items
|
||||
|
|
|
@ -98,11 +98,6 @@ public class BandcampStreamExtractor extends StreamExtractor {
|
|||
return albumJson.getString("artist");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUploaderVerified() throws ParsingException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getTextualUploadDate() {
|
||||
|
@ -132,24 +127,6 @@ public class BandcampStreamExtractor extends StreamExtractor {
|
|||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelAvatarUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Description getDescription() {
|
||||
|
@ -164,48 +141,6 @@ public class BandcampStreamExtractor extends StreamExtractor {
|
|||
return new Description(s, Description.PLAIN_TEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAgeLimit() {
|
||||
return NO_AGE_LIMIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLength() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTimeStamp() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getViewCount() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLikeCount() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDislikeCount() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getDashMpdUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getHlsUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AudioStream> getAudioStreams() {
|
||||
final List<AudioStream> audioStreams = new ArrayList<>();
|
||||
|
@ -228,18 +163,6 @@ public class BandcampStreamExtractor extends StreamExtractor {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<SubtitlesStream> getSubtitlesDefault() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<SubtitlesStream> getSubtitles(MediaFormat format) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamType getStreamType() {
|
||||
return StreamType.AUDIO_STREAM;
|
||||
|
@ -259,23 +182,6 @@ public class BandcampStreamExtractor extends StreamExtractor {
|
|||
return collector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getHost() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Privacy getPrivacy() {
|
||||
return Privacy.PUBLIC;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getCategory() {
|
||||
|
@ -315,12 +221,6 @@ public class BandcampStreamExtractor extends StreamExtractor {
|
|||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Locale getLanguageInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<String> getTags() {
|
||||
|
@ -334,22 +234,4 @@ public class BandcampStreamExtractor extends StreamExtractor {
|
|||
|
||||
return tags;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSupportInfo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<StreamSegment> getStreamSegments() throws ParsingException {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<MetaInfo> getMetaInfo() throws ParsingException {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,18 +60,6 @@ public class MediaCCCLiveStreamExtractor extends StreamExtractor {
|
|||
return room.getString("display");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getTextualUploadDate() throws ParsingException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DateWrapper getUploadDate() throws ParsingException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getThumbnailUrl() throws ParsingException {
|
||||
|
@ -84,36 +72,11 @@ public class MediaCCCLiveStreamExtractor extends StreamExtractor {
|
|||
return new Description(conference.getString("description") + " - " + group, Description.PLAIN_TEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAgeLimit() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLength() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTimeStamp() throws ParsingException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getViewCount() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLikeCount() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDislikeCount() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUploaderUrl() throws ParsingException {
|
||||
|
@ -126,41 +89,6 @@ public class MediaCCCLiveStreamExtractor extends StreamExtractor {
|
|||
return conference.getString("conference");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUploaderVerified() throws ParsingException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUploaderAvatarUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelAvatarUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getDashMpdUrl() throws ParsingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getHlsUrl() {
|
||||
|
@ -221,85 +149,14 @@ public class MediaCCCLiveStreamExtractor extends StreamExtractor {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<SubtitlesStream> getSubtitlesDefault() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<SubtitlesStream> getSubtitles(MediaFormat format) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamType getStreamType() throws ParsingException {
|
||||
return StreamType.LIVE_STREAM; // TODO: video and audio only streams are both available
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public StreamInfoItemsCollector getRelatedItems() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getHost() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Privacy getPrivacy() {
|
||||
return Privacy.PUBLIC;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getCategory() {
|
||||
return group;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getLicence() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Locale getLanguageInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<String> getTags() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSupportInfo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<StreamSegment> getStreamSegments() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<MetaInfo> getMetaInfo() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,36 +58,16 @@ public class MediaCCCStreamExtractor extends StreamExtractor {
|
|||
return new Description(data.getString("description"), Description.PLAIN_TEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAgeLimit() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLength() {
|
||||
return data.getInt("length");
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTimeStamp() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getViewCount() {
|
||||
return data.getInt("view_count");
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLikeCount() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDislikeCount() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUploaderUrl() {
|
||||
|
@ -101,47 +81,12 @@ public class MediaCCCStreamExtractor extends StreamExtractor {
|
|||
.replaceFirst("https://(api\\.)?media\\.ccc\\.de/public/conferences/", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUploaderVerified() throws ParsingException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUploaderAvatarUrl() {
|
||||
return conferenceData.getString("logo_url");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelAvatarUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getDashMpdUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getHlsUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AudioStream> getAudioStreams() throws ExtractionException {
|
||||
final JsonArray recordings = data.getArray("recordings");
|
||||
|
@ -200,34 +145,11 @@ public class MediaCCCStreamExtractor extends StreamExtractor {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<SubtitlesStream> getSubtitlesDefault() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<SubtitlesStream> getSubtitles(final MediaFormat format) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamType getStreamType() {
|
||||
return StreamType.VIDEO_STREAM;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public StreamInfoItemsCollector getRelatedItems() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFetchPage(@Nonnull final Downloader downloader)
|
||||
throws IOException, ExtractionException {
|
||||
|
@ -253,30 +175,6 @@ public class MediaCCCStreamExtractor extends StreamExtractor {
|
|||
return data.getString("frontend_link");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getHost() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Privacy getPrivacy() {
|
||||
return Privacy.PUBLIC;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getCategory() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getLicence() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getLanguageInfo() throws ParsingException {
|
||||
return Localization.getLocaleFromThreeLetterCode(data.getString("original_language"));
|
||||
|
@ -287,22 +185,4 @@ public class MediaCCCStreamExtractor extends StreamExtractor {
|
|||
public List<String> getTags() {
|
||||
return JsonUtils.getStringListFromJsonArray(data.getArray("tags"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSupportInfo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<StreamSegment> getStreamSegments() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<MetaInfo> getMetaInfo() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,11 +149,6 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||
return JsonUtils.getString(json, "account.displayName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUploaderVerified() throws ParsingException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUploaderAvatarUrl() {
|
||||
|
@ -190,12 +185,6 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||
return baseUrl + value;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getDashMpdUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getHlsUrl() {
|
||||
|
@ -329,18 +318,6 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<StreamSegment> getStreamSegments() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<MetaInfo> getMetaInfo() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private String getRelatedItemsUrl(final List<String> tags) throws UnsupportedEncodingException {
|
||||
final String url = baseUrl + PeertubeSearchQueryHandlerFactory.SEARCH_ENDPOINT;
|
||||
final StringBuilder params = new StringBuilder();
|
||||
|
@ -386,11 +363,6 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFetchPage(final Downloader downloader) throws IOException, ExtractionException {
|
||||
final Response response = downloader.get(baseUrl + PeertubeStreamLinkHandlerFactory.VIDEO_API_ENDPOINT + getId());
|
||||
|
|
|
@ -102,11 +102,6 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
return new Description(track.getString("description"), Description.PLAIN_TEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAgeLimit() {
|
||||
return NO_AGE_LIMIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLength() {
|
||||
return track.getLong("duration") / 1000L;
|
||||
|
@ -127,11 +122,6 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
return track.getLong("favoritings_count", -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDislikeCount() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUploaderUrl() {
|
||||
|
@ -155,36 +145,6 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
return SoundcloudParsingHelper.getAvatarUrl(track);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelAvatarUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getDashMpdUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getHlsUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AudioStream> getAudioStreams() throws ExtractionException {
|
||||
final List<AudioStream> audioStreams = new ArrayList<>();
|
||||
|
@ -343,18 +303,6 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public List<SubtitlesStream> getSubtitlesDefault() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public List<SubtitlesStream> getSubtitles(MediaFormat format) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamType getStreamType() {
|
||||
return StreamType.AUDIO_STREAM;
|
||||
|
@ -372,17 +320,6 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
return collector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getHost() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Privacy getPrivacy() {
|
||||
return track.getString("sharing").equals("public") ? Privacy.PUBLIC : Privacy.PRIVATE;
|
||||
|
@ -400,11 +337,6 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
return track.getString("license");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getLanguageInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<String> getTags() {
|
||||
|
@ -432,22 +364,4 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSupportInfo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<StreamSegment> getStreamSegments() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<MetaInfo> getMetaInfo() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -458,24 +458,6 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
return fixThumbnailUrl(url);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSubChannelAvatarUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getDashMpdUrl() throws ParsingException {
|
||||
|
@ -1257,12 +1239,6 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getHost() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Privacy getPrivacy() {
|
||||
|
@ -1304,12 +1280,6 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
.getArray("keywords"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getSupportInfo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<StreamSegment> getStreamSegments() throws ParsingException {
|
||||
|
|
|
@ -63,7 +63,9 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @see #getUploadDate()
|
||||
*/
|
||||
@Nullable
|
||||
public abstract String getTextualUploadDate() throws ParsingException;
|
||||
public String getTextualUploadDate() throws ParsingException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A more general {@code Calendar} instance set to the date provided by the service.<br>
|
||||
|
@ -77,7 +79,9 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @see #getTextualUploadDate()
|
||||
*/
|
||||
@Nullable
|
||||
public abstract DateWrapper getUploadDate() throws ParsingException;
|
||||
public DateWrapper getUploadDate() throws ParsingException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This will return the url to the thumbnail of the stream. Try to return the medium resolution here.
|
||||
|
@ -95,7 +99,9 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract Description getDescription() throws ParsingException;
|
||||
public Description getDescription() throws ParsingException {
|
||||
return Description.emptyDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the age limit.
|
||||
|
@ -103,52 +109,64 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @return The age which limits the content or {@value NO_AGE_LIMIT} if there is no limit
|
||||
* @throws ParsingException if an error occurs while parsing
|
||||
*/
|
||||
public abstract int getAgeLimit() throws ParsingException;
|
||||
public int getAgeLimit() throws ParsingException {
|
||||
return NO_AGE_LIMIT;
|
||||
}
|
||||
|
||||
/**
|
||||
* This should return the length of a video in seconds.
|
||||
*
|
||||
* @return The length of the stream in seconds.
|
||||
* @return The length of the stream in seconds or 0 when it has no length (e.g. a livestream).
|
||||
* @throws ParsingException
|
||||
*/
|
||||
public abstract long getLength() throws ParsingException;
|
||||
public long getLength() throws ParsingException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the url you are currently handling contains a time stamp/seek, you can return the
|
||||
* position it represents here.
|
||||
* If the url has no time stamp simply return zero.
|
||||
*
|
||||
* @return the timestamp in seconds
|
||||
* @return the timestamp in seconds or 0 when there is no timestamp
|
||||
* @throws ParsingException
|
||||
*/
|
||||
public abstract long getTimeStamp() throws ParsingException;
|
||||
public long getTimeStamp() throws ParsingException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The count of how many people have watched the video/listened to the audio stream.
|
||||
* If the current stream has no view count or its not available simply return -1
|
||||
*
|
||||
* @return amount of views.
|
||||
* @return amount of views or -1 if not available.
|
||||
* @throws ParsingException
|
||||
*/
|
||||
public abstract long getViewCount() throws ParsingException;
|
||||
public long getViewCount() throws ParsingException {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount of likes a video/audio stream got.
|
||||
* If the current stream has no likes or its not available simply return -1
|
||||
*
|
||||
* @return the amount of likes the stream got
|
||||
* @return the amount of likes the stream got or -1 if not available.
|
||||
* @throws ParsingException
|
||||
*/
|
||||
public abstract long getLikeCount() throws ParsingException;
|
||||
public long getLikeCount() throws ParsingException {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount of dislikes a video/audio stream got.
|
||||
* If the current stream has no dislikes or its not available simply return -1
|
||||
*
|
||||
* @return the amount of likes the stream got
|
||||
* @return the amount of likes the stream got or -1 if not available.
|
||||
* @throws ParsingException
|
||||
*/
|
||||
public abstract long getDislikeCount() throws ParsingException;
|
||||
public long getDislikeCount() throws ParsingException {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Url to the page of the creator/uploader of the stream. This must not be a homepage,
|
||||
|
@ -157,7 +175,7 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* so be sure to implement that one before you return a value here, otherwise NewPipe will crash if one selects
|
||||
* this url.
|
||||
*
|
||||
* @return the url to the page of the creator/uploader of the stream or an empty String
|
||||
* @return the url to the page of the creator/uploader of the stream or an empty string
|
||||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
|
@ -167,7 +185,7 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* The name of the creator/uploader of the stream.
|
||||
* If the name is not available you can simply return an empty string.
|
||||
*
|
||||
* @return the name of the creator/uploader of the stream or an empty String
|
||||
* @return the name of the creator/uploader of the stream or an empty tring
|
||||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
|
@ -180,7 +198,9 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @return whether the uploader has been verified by the service's provider
|
||||
* @throws ParsingException
|
||||
*/
|
||||
public abstract boolean isUploaderVerified() throws ParsingException;
|
||||
public boolean isUploaderVerified() throws ParsingException {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The url to the image file/profile picture/avatar of the creator/uploader of the stream.
|
||||
|
@ -190,7 +210,9 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract String getUploaderAvatarUrl() throws ParsingException;
|
||||
public String getUploaderAvatarUrl() throws ParsingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* The Url to the page of the sub-channel of the stream. This must not be a homepage,
|
||||
|
@ -203,7 +225,9 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract String getSubChannelUrl() throws ParsingException;
|
||||
public String getSubChannelUrl() throws ParsingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the sub-channel of the stream.
|
||||
|
@ -213,7 +237,9 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract String getSubChannelName() throws ParsingException;
|
||||
public String getSubChannelName() throws ParsingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* The url to the image file/profile picture/avatar of the sub-channel of the stream.
|
||||
|
@ -223,17 +249,21 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract String getSubChannelAvatarUrl() throws ParsingException;
|
||||
public String getSubChannelAvatarUrl() throws ParsingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the dash mpd url. If you don't know what a dash MPD is you can read about it
|
||||
* <a href="https://www.brendanlong.com/the-structure-of-an-mpeg-dash-mpd.html">here</a>.
|
||||
*
|
||||
* @return the url as a string or an empty string
|
||||
* @return the url as a string or an empty string or an empty string if not available
|
||||
* @throws ParsingException if an error occurs while reading
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract String getDashMpdUrl() throws ParsingException;
|
||||
public String getDashMpdUrl() throws ParsingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* I am not sure if this is in use, and how this is used. However the frontend is missing support
|
||||
|
@ -241,11 +271,13 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* <a href="https://github.com/teamnewpipe/newpipe/issues">issue</a>,
|
||||
* or fix this description if you know whats up with this.
|
||||
*
|
||||
* @return The Url to the hls stream.
|
||||
* @return The Url to the hls stream or an empty string if not available.
|
||||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract String getHlsUrl() throws ParsingException;
|
||||
public String getHlsUrl() throws ParsingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* This should return a list of available
|
||||
|
@ -298,7 +330,9 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @throws ExtractionException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract List<SubtitlesStream> getSubtitlesDefault() throws IOException, ExtractionException;
|
||||
public List<SubtitlesStream> getSubtitlesDefault() throws IOException, ExtractionException {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* This will return a list of available
|
||||
|
@ -312,7 +346,9 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @throws ExtractionException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract List<SubtitlesStream> getSubtitles(MediaFormat format) throws IOException, ExtractionException;
|
||||
public List<SubtitlesStream> getSubtitles(MediaFormat format) throws IOException, ExtractionException {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/">StreamType</a>.
|
||||
|
@ -334,13 +370,15 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @throws ExtractionException
|
||||
*/
|
||||
@Nullable
|
||||
public abstract InfoItemsCollector<? extends InfoItem, ? extends InfoItemExtractor>
|
||||
getRelatedItems() throws IOException, ExtractionException;
|
||||
public InfoItemsCollector<? extends InfoItem, ? extends InfoItemExtractor>
|
||||
getRelatedItems() throws IOException, ExtractionException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getRelatedItems()}. May be removed in a future version.
|
||||
* @return The result of {@link #getRelatedItems()} if it is a
|
||||
* StreamInfoItemsCollector, null otherwise
|
||||
* StreamInfoItemsCollector, <code>null</code> otherwise
|
||||
* @throws IOException
|
||||
* @throws ExtractionException
|
||||
*/
|
||||
|
@ -367,9 +405,11 @@ public abstract class StreamExtractor extends Extractor {
|
|||
/**
|
||||
* Should analyse the webpage's document and extracts any error message there might be.
|
||||
*
|
||||
* @return Error message; null if there is no error message.
|
||||
* @return Error message; <code>null</code> if there is no error message.
|
||||
*/
|
||||
public abstract String getErrorMessage();
|
||||
public String getErrorMessage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
/// Helper
|
||||
|
@ -435,30 +475,35 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* a federated system, but a centralised system,
|
||||
* you can simply return an empty string.
|
||||
*
|
||||
* @return the host of the stream or an empty String.
|
||||
* @return the host of the stream or an empty string.
|
||||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract String getHost() throws ParsingException;
|
||||
public String getHost() throws ParsingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* The privacy of the stream (Eg. Public, Private, Unlisted…).
|
||||
* If the privacy is not available you can simply return an empty string.
|
||||
*
|
||||
* @return the privacy of the stream or an empty String.
|
||||
* @return the privacy of the stream.
|
||||
* @throws ParsingException
|
||||
*/
|
||||
public abstract Privacy getPrivacy() throws ParsingException;
|
||||
public Privacy getPrivacy() throws ParsingException {
|
||||
return Privacy.PUBLIC;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the category of the stream.
|
||||
* If the category is not available you can simply return an empty string.
|
||||
*
|
||||
* @return the category of the stream or an empty String.
|
||||
* @return the category of the stream or an empty string.
|
||||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract String getCategory() throws ParsingException;
|
||||
public String getCategory() throws ParsingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the licence of the stream.
|
||||
|
@ -468,7 +513,9 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract String getLicence() throws ParsingException;
|
||||
public String getLicence() throws ParsingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* The locale language of the stream.
|
||||
|
@ -476,11 +523,13 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* If the language is provided by a language code, you can return
|
||||
* new Locale(language_code);
|
||||
*
|
||||
* @return the locale language of the stream or null.
|
||||
* @return the locale language of the stream or <code>null</code>.
|
||||
* @throws ParsingException
|
||||
*/
|
||||
@Nullable
|
||||
public abstract Locale getLanguageInfo() throws ParsingException;
|
||||
public Locale getLanguageInfo() throws ParsingException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of tags of the stream.
|
||||
|
@ -490,7 +539,9 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract List<String> getTags() throws ParsingException;
|
||||
public List<String> getTags() throws ParsingException {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* The support information of the stream.
|
||||
|
@ -499,11 +550,13 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* If the support information are not available,
|
||||
* you can simply return an empty String.
|
||||
*
|
||||
* @return the support information of the stream or an empty String.
|
||||
* @return the support information of the stream or an empty string.
|
||||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract String getSupportInfo() throws ParsingException;
|
||||
public String getSupportInfo() throws ParsingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of stream segments by timestamps for the stream.
|
||||
|
@ -513,7 +566,9 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract List<StreamSegment> getStreamSegments() throws ParsingException;
|
||||
public List<StreamSegment> getStreamSegments() throws ParsingException {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about the stream.
|
||||
|
@ -524,11 +579,14 @@ public abstract class StreamExtractor extends Extractor {
|
|||
* </p>
|
||||
* The meta information often contains links to external sources like Wikipedia or the WHO.
|
||||
*
|
||||
* @return The meta info of the stream or an empty List if not provided.
|
||||
* @return The meta info of the stream or an empty list if not provided.
|
||||
* @throws ParsingException
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract List<MetaInfo> getMetaInfo() throws ParsingException;
|
||||
public List<MetaInfo> getMetaInfo() throws ParsingException {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public enum Privacy {
|
||||
PUBLIC,
|
||||
UNLISTED,
|
||||
|
|
Loading…
Reference in New Issue