From 1a322ad8edcf54e90f84d236fbe6dce1a9d8ae47 Mon Sep 17 00:00:00 2001 From: bopol Date: Fri, 22 Jan 2021 01:44:58 +0100 Subject: [PATCH] Add uploader verified by service extraction --- .../extractor/channel/ChannelExtractor.java | 2 + .../extractor/channel/ChannelInfoItem.java | 10 +++- .../channel/ChannelInfoItemExtractor.java | 3 ++ .../channel/ChannelInfoItemsCollector.java | 6 +++ .../extractor/comments/CommentsInfoItem.java | 9 ++++ .../comments/CommentsInfoItemExtractor.java | 5 ++ .../extractor/playlist/PlaylistExtractor.java | 1 + .../MediaCCCConferenceExtractor.java | 9 ++-- .../MediaCCCLiveStreamExtractor.java | 11 +++-- .../MediaCCCLiveStreamKioskExtractor.java | 5 ++ .../MediaCCCRecentKioskExtractor.java | 5 ++ .../extractors/MediaCCCSearchExtractor.java | 5 ++ .../extractors/MediaCCCStreamExtractor.java | 24 ++++------ .../MediaCCCConferenceInfoItemExtractor.java | 5 ++ .../MediaCCCStreamInfoItemExtractor.java | 5 ++ .../extractors/PeertubeAccountExtractor.java | 5 ++ .../extractors/PeertubeChannelExtractor.java | 5 ++ .../PeertubeCommentsInfoItemExtractor.java | 5 ++ .../extractors/PeertubePlaylistExtractor.java | 14 +++--- .../extractors/PeertubeStreamExtractor.java | 5 ++ .../PeertubeStreamInfoItemExtractor.java | 5 ++ .../SoundcloudChannelExtractor.java | 5 ++ .../SoundcloudChannelInfoItemExtractor.java | 5 ++ .../SoundcloudCommentsInfoItemExtractor.java | 8 +++- .../SoundcloudPlaylistExtractor.java | 5 ++ .../extractors/SoundcloudStreamExtractor.java | 5 ++ .../SoundcloudStreamInfoItemExtractor.java | 8 +++- .../youtube/YoutubeParsingHelper.java | 17 +++++++ .../extractors/YoutubeChannelExtractor.java | 8 ++++ .../YoutubeChannelInfoItemExtractor.java | 6 +++ .../YoutubeCommentsInfoItemExtractor.java | 5 ++ .../YoutubeFeedInfoItemExtractor.java | 5 ++ .../YoutubeMixPlaylistExtractor.java | 25 +++++----- .../extractors/YoutubePlaylistExtractor.java | 37 ++++++++------- .../extractors/YoutubeStreamExtractor.java | 8 ++++ .../YoutubeStreamInfoItemExtractor.java | 5 ++ .../extractor/stream/StreamExtractor.java | 21 ++++++--- .../extractor/stream/StreamInfoItem.java | 13 ++++- .../stream/StreamInfoItemExtractor.java | 9 ++++ .../stream/StreamInfoItemsCollector.java | 6 +++ .../services/BaseChannelExtractorTest.java | 1 + .../services/BasePlaylistExtractorTest.java | 1 + .../services/DefaultStreamExtractorTest.java | 6 +++ .../PeertubeAccountExtractorTest.java | 10 ++++ .../PeertubeChannelExtractorTest.java | 11 ++++- .../SoundcloudChannelExtractorTest.java | 10 ++++ .../SoundcloudPlaylistExtractorTest.java | 20 ++++++++ .../search/SoundcloudSearchExtractorTest.java | 41 ++++++++++++++++ .../youtube/YoutubeChannelExtractorTest.java | 34 +++++++++++--- .../youtube/YoutubePlaylistExtractorTest.java | 33 ++++++++----- .../search/YoutubeSearchExtractorTest.java | 47 +++++++++++++++++-- ...utubeStreamExtractorAgeRestrictedTest.java | 1 + .../YoutubeStreamExtractorDefaultTest.java | 4 ++ .../YoutubeStreamExtractorLivestreamTest.java | 1 + 54 files changed, 474 insertions(+), 91 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java index 3f54f1c2..8f2fe79a 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java @@ -40,4 +40,6 @@ public abstract class ChannelExtractor extends ListExtractor { public abstract String getParentChannelName() throws ParsingException; public abstract String getParentChannelUrl() throws ParsingException; public abstract String getParentChannelAvatarUrl() throws ParsingException; + public abstract boolean isVerified() throws ParsingException; + } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItem.java b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItem.java index 6d2e61a3..51b9619a 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItem.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItem.java @@ -27,7 +27,7 @@ public class ChannelInfoItem extends InfoItem { private String description; private long subscriberCount = -1; private long streamCount = -1; - + private boolean verified = false; public ChannelInfoItem(int serviceId, String url, String name) { super(InfoType.CHANNEL, serviceId, url, name); @@ -56,4 +56,12 @@ public class ChannelInfoItem extends InfoItem { public void setStreamCount(long stream_count) { this.streamCount = stream_count; } + + public boolean isVerified() { + return verified; + } + + public void setVerified(boolean verified) { + this.verified = verified; + } } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemExtractor.java index 4d667733..6c22c337 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemExtractor.java @@ -27,5 +27,8 @@ public interface ChannelInfoItemExtractor extends InfoItemExtractor { String getDescription() throws ParsingException; long getSubscriberCount() throws ParsingException; + long getStreamCount() throws ParsingException; + + boolean isVerified() throws ParsingException; } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemsCollector.java b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemsCollector.java index 19abb1c2..454ba30a 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemsCollector.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemsCollector.java @@ -59,6 +59,12 @@ public class ChannelInfoItemsCollector extends InfoItemsCollector { public abstract String getUploaderUrl() throws ParsingException; public abstract String getUploaderName() throws ParsingException; public abstract String getUploaderAvatarUrl() throws ParsingException; + public abstract boolean isUploaderVerified() throws ParsingException; public abstract long getStreamCount() throws ParsingException; diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCConferenceExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCConferenceExtractor.java index 77ea3ad1..22571b89 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCConferenceExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCConferenceExtractor.java @@ -4,7 +4,6 @@ import com.grack.nanojson.JsonArray; import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonParser; import com.grack.nanojson.JsonParserException; - import org.schabi.newpipe.extractor.Page; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.channel.ChannelExtractor; @@ -17,9 +16,8 @@ import org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCConfe import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector; -import java.io.IOException; - import javax.annotation.Nonnull; +import java.io.IOException; public class MediaCCCConferenceExtractor extends ChannelExtractor { private JsonObject conferenceData; @@ -69,6 +67,11 @@ public class MediaCCCConferenceExtractor extends ChannelExtractor { return ""; } + @Override + public boolean isVerified() throws ParsingException { + return false; + } + @Nonnull @Override public InfoItemsPage getInitialPage() { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCLiveStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCLiveStreamExtractor.java index 60594794..77ef6893 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCLiveStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCLiveStreamExtractor.java @@ -126,6 +126,11 @@ public class MediaCCCLiveStreamExtractor extends StreamExtractor { return conference.getString("conference"); } + @Override + public boolean isUploaderVerified() throws ParsingException { + return false; + } + @Nonnull @Override public String getUploaderAvatarUrl() { @@ -180,7 +185,7 @@ public class MediaCCCLiveStreamExtractor extends StreamExtractor { for (int s = 0; s < room.getArray("streams").size(); s++) { final JsonObject stream = room.getArray("streams").getObject(s); if (stream.getString("type").equals("audio")) { - for (final String type :stream.getObject("urls").keySet()) { + for (final String type : stream.getObject("urls").keySet()) { final JsonObject url = stream.getObject("urls").getObject(type); audioStreams.add(new AudioStream(url.getString("url"), MediaFormat.getFromSuffix(type), -1)); } @@ -197,7 +202,7 @@ public class MediaCCCLiveStreamExtractor extends StreamExtractor { if (stream.getString("type").equals("video")) { final String resolution = stream.getArray("videoSize").getInt(0) + "x" + stream.getArray("videoSize").getInt(1); - for (final String type :stream.getObject("urls").keySet()) { + for (final String type : stream.getObject("urls").keySet()) { if (!type.equals("hls")) { final JsonObject url = stream.getObject("urls").getObject(type); videoStreams.add(new VideoStream( @@ -218,7 +223,7 @@ public class MediaCCCLiveStreamExtractor extends StreamExtractor { @Nonnull @Override - public List getSubtitlesDefault(){ + public List getSubtitlesDefault() { return Collections.emptyList(); } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCLiveStreamKioskExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCLiveStreamKioskExtractor.java index a4c99e49..504dd3b0 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCLiveStreamKioskExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCLiveStreamKioskExtractor.java @@ -73,6 +73,11 @@ public class MediaCCCLiveStreamKioskExtractor implements StreamInfoItemExtractor return "https://media.ccc.de/c/" + conferenceInfo.getString("slug"); } + @Override + public boolean isUploaderVerified() throws ParsingException { + return false; + } + @Nullable @Override public String getTextualUploadDate() throws ParsingException { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCRecentKioskExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCRecentKioskExtractor.java index b5d34e19..2ff86a4f 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCRecentKioskExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCRecentKioskExtractor.java @@ -68,6 +68,11 @@ public class MediaCCCRecentKioskExtractor implements StreamInfoItemExtractor { .getUrl(); // web URL } + @Override + public boolean isUploaderVerified() throws ParsingException { + return false; + } + @Nullable @Override public String getTextualUploadDate() throws ParsingException { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCSearchExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCSearchExtractor.java index cc9e552a..82c57475 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCSearchExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCSearchExtractor.java @@ -142,6 +142,11 @@ public class MediaCCCSearchExtractor extends SearchExtractor { return item.getStreamCount(); } + @Override + public boolean isVerified() throws ParsingException { + return false; + } + @Override public String getName() { return item.getName(); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java index 09292380..1ae8508a 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java @@ -4,7 +4,6 @@ import com.grack.nanojson.JsonArray; import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonParser; import com.grack.nanojson.JsonParserException; - import org.schabi.newpipe.extractor.MediaFormat; import org.schabi.newpipe.extractor.MetaInfo; import org.schabi.newpipe.extractor.StreamingService; @@ -13,26 +12,14 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.linkhandler.LinkHandler; import org.schabi.newpipe.extractor.localization.DateWrapper; -import org.schabi.newpipe.extractor.stream.AudioStream; -import org.schabi.newpipe.extractor.stream.Description; -import org.schabi.newpipe.extractor.stream.StreamExtractor; -import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector; -import org.schabi.newpipe.extractor.stream.StreamSegment; -import org.schabi.newpipe.extractor.stream.StreamType; -import org.schabi.newpipe.extractor.stream.SubtitlesStream; -import org.schabi.newpipe.extractor.stream.VideoStream; import org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCConferenceLinkHandlerFactory; import org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCStreamLinkHandlerFactory; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Locale; +import org.schabi.newpipe.extractor.stream.*; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.io.IOException; +import java.util.*; public class MediaCCCStreamExtractor extends StreamExtractor { private JsonObject data; @@ -109,6 +96,11 @@ 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() { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/infoItems/MediaCCCConferenceInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/infoItems/MediaCCCConferenceInfoItemExtractor.java index 3ced44d9..b69d7a90 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/infoItems/MediaCCCConferenceInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/infoItems/MediaCCCConferenceInfoItemExtractor.java @@ -28,6 +28,11 @@ public class MediaCCCConferenceInfoItemExtractor implements ChannelInfoItemExtra return ListExtractor.ITEM_COUNT_UNKNOWN; } + @Override + public boolean isVerified() throws ParsingException { + return false; + } + @Override public String getName() throws ParsingException { return conference.getString("title"); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/infoItems/MediaCCCStreamInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/infoItems/MediaCCCStreamInfoItemExtractor.java index 3dee8ac3..02316643 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/infoItems/MediaCCCStreamInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/infoItems/MediaCCCStreamInfoItemExtractor.java @@ -46,6 +46,11 @@ public class MediaCCCStreamInfoItemExtractor implements StreamInfoItemExtractor return event.getString("conference_url"); } + @Override + public boolean isUploaderVerified() throws ParsingException { + return false; + } + @Nullable @Override public String getTextualUploadDate() { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeAccountExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeAccountExtractor.java index 79876765..282e6d9c 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeAccountExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeAccountExtractor.java @@ -83,6 +83,11 @@ public class PeertubeAccountExtractor extends ChannelExtractor { return ""; } + @Override + public boolean isVerified() throws ParsingException { + return false; + } + @Nonnull @Override public InfoItemsPage getInitialPage() throws IOException, ExtractionException { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeChannelExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeChannelExtractor.java index dc5a54fd..67ef38c2 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeChannelExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeChannelExtractor.java @@ -90,6 +90,11 @@ public class PeertubeChannelExtractor extends ChannelExtractor { return baseUrl + value; } + @Override + public boolean isVerified() throws ParsingException { + return false; + } + @Nonnull @Override public InfoItemsPage getInitialPage() throws IOException, ExtractionException { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeCommentsInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeCommentsInfoItemExtractor.java index 38c81988..812e454f 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeCommentsInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeCommentsInfoItemExtractor.java @@ -99,6 +99,11 @@ public class PeertubeCommentsInfoItemExtractor implements CommentsInfoItemExtrac return false; } + @Override + public boolean isUploaderVerified() throws ParsingException { + return false; + } + @Override public String getUploaderName() throws ParsingException { return JsonUtils.getString(item, "account.name") + "@" + JsonUtils.getString(item, "account.host"); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubePlaylistExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubePlaylistExtractor.java index b2298536..89340df3 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubePlaylistExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubePlaylistExtractor.java @@ -3,7 +3,6 @@ package org.schabi.newpipe.extractor.services.peertube.extractors; import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonParser; import com.grack.nanojson.JsonParserException; - import org.schabi.newpipe.extractor.Page; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.downloader.Downloader; @@ -17,14 +16,10 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector; import org.schabi.newpipe.extractor.utils.Utils; +import javax.annotation.Nonnull; import java.io.IOException; -import javax.annotation.Nonnull; - -import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.COUNT_KEY; -import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.ITEMS_PER_PAGE; -import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.START_KEY; -import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.collectStreamsFrom; +import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.*; import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty; public class PeertubePlaylistExtractor extends PlaylistExtractor { @@ -59,6 +54,11 @@ public class PeertubePlaylistExtractor extends PlaylistExtractor { return getBaseUrl() + playlistInfo.getObject("ownerAccount").getObject("avatar").getString("path"); } + @Override + public boolean isUploaderVerified() throws ParsingException { + return false; + } + @Override public long getStreamCount() { return playlistInfo.getLong("videosLength"); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java index cfcd1e7b..56dbf08f 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java @@ -148,6 +148,11 @@ public class PeertubeStreamExtractor extends StreamExtractor { return JsonUtils.getString(json, "account.displayName"); } + @Override + public boolean isUploaderVerified() throws ParsingException { + return false; + } + @Nonnull @Override public String getUploaderAvatarUrl() { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamInfoItemExtractor.java index 4ab27ae4..7ea3e1d8 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamInfoItemExtractor.java @@ -54,6 +54,11 @@ public class PeertubeStreamInfoItemExtractor implements StreamInfoItemExtractor .fromId("accounts/" + name + "@" + host, baseUrl).getUrl(); } + @Override + public boolean isUploaderVerified() throws ParsingException { + return false; + } + @Override public String getUploaderName() throws ParsingException { return JsonUtils.getString(item, "account.displayName"); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelExtractor.java index 52151d3d..082de81c 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelExtractor.java @@ -96,6 +96,11 @@ public class SoundcloudChannelExtractor extends ChannelExtractor { return ""; } + @Override + public boolean isVerified() throws ParsingException { + return user.getBoolean("verified"); + } + @Nonnull @Override public InfoItemsPage getInitialPage() throws ExtractionException { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelInfoItemExtractor.java index ef5270e7..39f58d86 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelInfoItemExtractor.java @@ -40,6 +40,11 @@ public class SoundcloudChannelInfoItemExtractor implements ChannelInfoItemExtrac return itemObject.getLong("track_count"); } + @Override + public boolean isVerified() { + return itemObject.getBoolean("verified"); + } + @Override public String getDescription() { return itemObject.getString("description", EMPTY_STRING); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudCommentsInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudCommentsInfoItemExtractor.java index cf574aa2..edceb1c8 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudCommentsInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudCommentsInfoItemExtractor.java @@ -6,9 +6,8 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.localization.DateWrapper; import org.schabi.newpipe.extractor.services.soundcloud.SoundcloudParsingHelper; -import java.util.Objects; - import javax.annotation.Nullable; +import java.util.Objects; public class SoundcloudCommentsInfoItemExtractor implements CommentsInfoItemExtractor { private JsonObject json; @@ -49,6 +48,11 @@ public class SoundcloudCommentsInfoItemExtractor implements CommentsInfoItemExtr return false; } + @Override + public boolean isUploaderVerified() throws ParsingException { + return json.getObject("user").getBoolean("verified"); + } + @Override public String getUploaderUrl() { return json.getObject("user").getString("permalink_url"); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudPlaylistExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudPlaylistExtractor.java index 878a7766..4b711e75 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudPlaylistExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudPlaylistExtractor.java @@ -111,6 +111,11 @@ public class SoundcloudPlaylistExtractor extends PlaylistExtractor { return SoundcloudParsingHelper.getAvatarUrl(playlist); } + @Override + public boolean isUploaderVerified() throws ParsingException { + return playlist.getObject("user").getBoolean("verified"); + } + @Override public long getStreamCount() { return playlist.getLong("track_count"); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamExtractor.java index 9e4ed6bb..fc246dfb 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamExtractor.java @@ -131,6 +131,11 @@ public class SoundcloudStreamExtractor extends StreamExtractor { return SoundcloudParsingHelper.getUploaderName(track); } + @Override + public boolean isUploaderVerified() throws ParsingException { + return track.getObject("user").getBoolean("verified"); + } + @Nonnull @Override public String getUploaderAvatarUrl() { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamInfoItemExtractor.java index 4e176231..79d937c2 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamInfoItemExtractor.java @@ -43,6 +43,11 @@ public class SoundcloudStreamInfoItemExtractor implements StreamInfoItemExtracto return replaceHttpWithHttps(itemObject.getObject("user").getString("permalink_url")); } + @Override + public boolean isUploaderVerified() throws ParsingException { + return itemObject.getObject("user").getBoolean("verified"); + } + @Override public String getTextualUploadDate() { return itemObject.getString("created_at"); @@ -64,8 +69,7 @@ public class SoundcloudStreamInfoItemExtractor implements StreamInfoItemExtracto if (artworkUrl.isEmpty()) { artworkUrl = itemObject.getObject("user").getString("avatar_url"); } - String artworkUrlBetterResolution = artworkUrl.replace("large.jpg", "crop.jpg"); - return artworkUrlBetterResolution; + return artworkUrl.replace("large.jpg", "crop.jpg"); } @Override diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java index dd636833..c0e87212 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java @@ -804,4 +804,21 @@ public class YoutubeParsingHelper { } return url; } + + public static boolean isVerified(final JsonArray badges) { + if (Utils.isNullOrEmpty(badges)) { + return false; + } + + for (Object badge : badges) { + final String style = ((JsonObject) badge).getObject("metadataBadgeRenderer") + .getString("style"); + if (style != null && (style.equals("BADGE_STYLE_TYPE_VERIFIED") + || style.equals("BADGE_STYLE_TYPE_VERIFIED_ARTIST"))) { + return true; + } + } + + return false; + } } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java index db046f8b..4ed926ee 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java @@ -216,6 +216,14 @@ public class YoutubeChannelExtractor extends ChannelExtractor { return ""; } + @Override + public boolean isVerified() throws ParsingException { + final JsonArray badges = initialData.getObject("header").getObject("c4TabbedHeaderRenderer") + .getArray("badges"); + + return YoutubeParsingHelper.isVerified(badges); + } + @Nonnull @Override public InfoItemsPage getInitialPage() throws ExtractionException { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelInfoItemExtractor.java index fbab74d8..27bc1920 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelInfoItemExtractor.java @@ -5,6 +5,7 @@ import com.grack.nanojson.JsonObject; import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor; import org.schabi.newpipe.extractor.exceptions.ParsingException; +import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper; import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeChannelLinkHandlerFactory; import org.schabi.newpipe.extractor.utils.Utils; @@ -97,6 +98,11 @@ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor } } + @Override + public boolean isVerified() throws ParsingException { + return YoutubeParsingHelper.isVerified(channelInfoItem.getArray("ownerBadges")); + } + @Override public String getDescription() throws ParsingException { try { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeCommentsInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeCommentsInfoItemExtractor.java index 4276800b..ddb5c6e8 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeCommentsInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeCommentsInfoItemExtractor.java @@ -125,6 +125,11 @@ public class YoutubeCommentsInfoItemExtractor implements CommentsInfoItemExtract return json.has("pinnedCommentBadge"); } + public boolean isUploaderVerified() throws ParsingException { + // impossible to get this information from the mobile layout + return false; + } + @Override public String getUploaderName() throws ParsingException { try { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeFeedInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeFeedInfoItemExtractor.java index 3945ff17..a1883621 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeFeedInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeFeedInfoItemExtractor.java @@ -50,6 +50,11 @@ public class YoutubeFeedInfoItemExtractor implements StreamInfoItemExtractor { return entryElement.select("author > uri").first().text(); } + @Override + public boolean isUploaderVerified() throws ParsingException { + return false; + } + @Nullable @Override public String getTextualUploadDate() { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java index d424129e..5f876e71 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java @@ -2,7 +2,6 @@ package org.schabi.newpipe.extractor.services.youtube.extractors; import com.grack.nanojson.JsonArray; import com.grack.nanojson.JsonObject; - import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.Page; import org.schabi.newpipe.extractor.StreamingService; @@ -16,18 +15,13 @@ import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.io.IOException; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.extractCookieValue; -import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getJsonResponse; -import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getResponse; -import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getUrlFromNavigationEndpoint; -import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.toJsonArray; +import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.*; import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty; /** @@ -82,8 +76,8 @@ public class YoutubeMixPlaylistExtractor extends PlaylistExtractor { try { //fallback to thumbnail of current video. Always the case for channel mix return getThumbnailUrlFromVideoId( - initialData.getObject("currentVideoEndpoint").getObject("watchEndpoint") - .getString("videoId")); + initialData.getObject("currentVideoEndpoint").getObject("watchEndpoint") + .getString("videoId")); } catch (final Exception ignored) { } throw new ParsingException("Could not get playlist thumbnail", e); @@ -113,6 +107,11 @@ public class YoutubeMixPlaylistExtractor extends PlaylistExtractor { return ""; } + @Override + public boolean isUploaderVerified() throws ParsingException { + return false; + } + @Override public long getStreamCount() { // Auto-generated playlist always start with 25 videos and are endless @@ -144,7 +143,7 @@ public class YoutubeMixPlaylistExtractor extends PlaylistExtractor { public InfoItemsPage getPage(final Page page) throws ExtractionException, IOException { if (page == null || isNullOrEmpty(page.getUrl())) { - throw new IllegalArgumentException("Page url is empty or null"); + throw new IllegalArgumentException("Page url is empty or null"); } if (!page.getCookies().containsKey(COOKIE_NAME)) { throw new IllegalArgumentException("Cooke '" + COOKIE_NAME + "' is missing"); @@ -180,7 +179,7 @@ public class YoutubeMixPlaylistExtractor extends PlaylistExtractor { for (final Object stream : streams) { if (stream instanceof JsonObject) { final JsonObject streamInfo = ((JsonObject) stream) - .getObject("playlistPanelVideoRenderer"); + .getObject("playlistPanelVideoRenderer"); if (streamInfo != null) { collector.commit(new YoutubeStreamInfoItemExtractor(streamInfo, timeAgoParser)); } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubePlaylistExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubePlaylistExtractor.java index 0e2ad2a4..6a6ab97a 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubePlaylistExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubePlaylistExtractor.java @@ -2,7 +2,6 @@ package org.schabi.newpipe.extractor.services.youtube.extractors; import com.grack.nanojson.JsonArray; import com.grack.nanojson.JsonObject; - import org.schabi.newpipe.extractor.Page; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.downloader.Downloader; @@ -20,15 +19,11 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector; import org.schabi.newpipe.extractor.stream.StreamType; import org.schabi.newpipe.extractor.utils.Utils; -import java.io.IOException; - import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.io.IOException; -import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.fixThumbnailUrl; -import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getJsonResponse; -import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getTextFromObject; -import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getUrlFromNavigationEndpoint; +import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.*; import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty; @SuppressWarnings("WeakerAccess") @@ -138,6 +133,11 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor { } } + @Override + public boolean isUploaderVerified() throws ParsingException { + return false; + } + @Override public long getStreamCount() throws ParsingException { try { @@ -209,11 +209,11 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor { final JsonArray ajaxJson = getJsonResponse(page.getUrl(), getExtractorLocalization()); final JsonArray continuation = ajaxJson.getObject(1) - .getObject("response") - .getArray("onResponseReceivedActions") - .getObject(0) - .getObject("appendContinuationItemsAction") - .getArray("continuationItems"); + .getObject("response") + .getArray("onResponseReceivedActions") + .getObject(0) + .getObject("appendContinuationItemsAction") + .getArray("continuationItems"); collectStreamsFrom(collector, continuation); @@ -228,10 +228,10 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor { final JsonObject lastElement = contents.getObject(contents.size() - 1); if (lastElement.has("continuationItemRenderer")) { final String continuation = lastElement - .getObject("continuationItemRenderer") - .getObject("continuationEndpoint") - .getObject("continuationCommand") - .getString("token"); + .getObject("continuationItemRenderer") + .getObject("continuationEndpoint") + .getObject("continuationCommand") + .getString("token"); return new Page("https://www.youtube.com/browse_ajax?continuation=" + continuation); } else { return null; @@ -311,6 +311,11 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor { return YoutubePlaylistExtractor.this.getUploaderUrl(); } + @Override + public boolean isUploaderVerified() { + return false; + } + @Nullable @Override public String getTextualUploadDate() { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java index 2ff4cf4d..5050a158 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java @@ -412,6 +412,14 @@ public class YoutubeStreamExtractor extends StreamExtractor { return uploaderName; } + @Override + public boolean isUploaderVerified() throws ParsingException { + final JsonArray badges = getVideoSecondaryInfoRenderer().getObject("owner") + .getObject("videoOwnerRenderer").getArray("badges"); + + return YoutubeParsingHelper.isVerified(badges); + } + @Nonnull @Override public String getUploaderAvatarUrl() throws ParsingException { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamInfoItemExtractor.java index 42e39b72..4fa6caab 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamInfoItemExtractor.java @@ -158,6 +158,11 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor { return url; } + @Override + public boolean isUploaderVerified() throws ParsingException { + return YoutubeParsingHelper.isVerified(videoInfo.getArray("ownerBadges")); + } + @Nullable @Override public String getTextualUploadDate() throws ParsingException { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java index faf6b0ef..3596f2f7 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java @@ -31,14 +31,13 @@ import org.schabi.newpipe.extractor.linkhandler.LinkHandler; import org.schabi.newpipe.extractor.localization.DateWrapper; import org.schabi.newpipe.extractor.utils.Parser; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.io.IOException; import java.util.Collections; import java.util.List; import java.util.Locale; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * Scrapes information from a video/audio streaming service (eg, YouTube). */ @@ -171,6 +170,15 @@ public abstract class StreamExtractor extends Extractor { @Nonnull public abstract String getUploaderName() throws ParsingException; + /** + * Whether the uploader has been verified by the service's provider. + * If there is no verification implemented, return false. + * + * @return whether the uploader has been verified by the service's provider + * @throws ParsingException + */ + public abstract boolean isUploaderVerified() throws ParsingException; + /** * The url to the image file/profile picture/avatar of the creator/uploader of the stream. * If the url is not available you can return an empty String. @@ -479,8 +487,8 @@ public abstract class StreamExtractor extends Extractor { public abstract String getSupportInfo() throws ParsingException; /** - * The list of stream segments by timestamps for the stream. - * If the segment list is not available you can simply return an empty list. + * The list of stream segments by timestamps for the stream. + * If the segment list is not available you can simply return an empty list. * * @return The list of segments of the stream or an empty list. * @throws ParsingException @@ -495,7 +503,8 @@ public abstract class StreamExtractor extends Extractor { * or further information on the topic (e.g. hints that the video might contain conspiracy theories * or contains information about a current health situation like the Covid-19 pandemic). *

- * The meta information often contains links to external sources like Wikipedia or the WHO. + * 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. * @throws ParsingException */ diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItem.java b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItem.java index 6623c1ef..63c57415 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItem.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItem.java @@ -33,11 +33,13 @@ public class StreamInfoItem extends InfoItem { private String uploaderName; private String textualUploadDate; - @Nullable private DateWrapper uploadDate; + @Nullable + private DateWrapper uploadDate; private long viewCount = -1; private long duration = -1; private String uploaderUrl = null; + private boolean uploaderVerified = false; public StreamInfoItem(int serviceId, String url, String name, StreamType streamType) { super(InfoType.STREAM, serviceId, url, name); @@ -98,6 +100,14 @@ public class StreamInfoItem extends InfoItem { this.uploadDate = uploadDate; } + public boolean isUploaderVerified() { + return uploaderVerified; + } + + public void setUploaderVerified(boolean uploaderVerified) { + this.uploaderVerified = uploaderVerified; + } + @Override public String toString() { return "StreamInfoItem{" + @@ -112,6 +122,7 @@ public class StreamInfoItem extends InfoItem { ", url='" + getUrl() + '\'' + ", name='" + getName() + '\'' + ", thumbnailUrl='" + getThumbnailUrl() + '\'' + + ", uploaderVerified='" + isUploaderVerified() + '\'' + '}'; } } \ No newline at end of file diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemExtractor.java index 828d4520..c9e45170 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemExtractor.java @@ -71,6 +71,15 @@ public interface StreamInfoItemExtractor extends InfoItemExtractor { String getUploaderUrl() throws ParsingException; + /** + * Whether the uploader has been verified by the service's provider. + * If there is no verification implemented, return false. + * + * @return whether the uploader has been verified by the service's provider + * @throws ParsingException + */ + boolean isUploaderVerified() throws ParsingException; + /** * The original textual date provided by the service. Should be used as a fallback if * {@link #getUploadDate()} isn't provided by the service, or it fails for some reason. diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemsCollector.java b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemsCollector.java index da334310..1e6e6e91 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemsCollector.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemsCollector.java @@ -90,6 +90,12 @@ public class StreamInfoItemsCollector extends InfoItemsCollector expectedDescriptionContains(); // e.g. for full links @@ -99,6 +100,11 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest= 500); } + + @Override + public void testVerified() throws Exception { + assertFalse(extractor.isVerified()); + } } public static class FreeSoftwareFoundation implements BaseChannelExtractorTest { @@ -200,5 +205,10 @@ public class PeertubeAccountExtractorTest { public void testSubscriberCount() throws ParsingException { assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 100); } + + @Override + public void testVerified() throws Exception { + assertFalse(extractor.isVerified()); + } } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeChannelExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeChannelExtractorTest.java index 6215792c..7b2fc3da 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeChannelExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeChannelExtractorTest.java @@ -1,7 +1,6 @@ package org.schabi.newpipe.extractor.services.peertube; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.schabi.newpipe.downloader.DownloaderTestImpl; import org.schabi.newpipe.extractor.NewPipe; @@ -119,6 +118,11 @@ public class PeertubeChannelExtractorTest { public void testSubscriberCount() throws ParsingException { assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 230); } + + @Override + public void testVerified() throws Exception { + assertFalse(extractor.isVerified()); + } } public static class ChatSceptique implements BaseChannelExtractorTest { @@ -231,5 +235,10 @@ public class PeertubeChannelExtractorTest { public void testSubscriberCount() throws ParsingException { assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 700); } + + @Override + public void testVerified() throws Exception { + assertFalse(extractor.isVerified()); + } } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java index feb001d8..18d9ea60 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java @@ -101,6 +101,11 @@ public class SoundcloudChannelExtractorTest { public void testSubscriberCount() { assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 1e6); } + + @Override + public void testVerified() throws Exception { + assertTrue(extractor.isVerified()); + } } public static class DubMatix implements BaseChannelExtractorTest { @@ -195,5 +200,10 @@ public class SoundcloudChannelExtractorTest { public void testSubscriberCount() { assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 2e6); } + + @Override + public void testVerified() throws Exception { + assertTrue(extractor.isVerified()); + } } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractorTest.java index 2a5ace09..53870b74 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractorTest.java @@ -111,6 +111,11 @@ public class SoundcloudPlaylistExtractorTest { public void testStreamCount() { assertTrue("Stream count does not fit: " + extractor.getStreamCount(), extractor.getStreamCount() >= 10); } + + @Override + public void testUploaderVerified() throws Exception { + assertTrue(extractor.isUploaderVerified()); + } } public static class RandomHouseMusic implements BasePlaylistExtractorTest { @@ -203,6 +208,11 @@ public class SoundcloudPlaylistExtractorTest { public void testStreamCount() { assertTrue("Stream count does not fit: " + extractor.getStreamCount(), extractor.getStreamCount() >= 10); } + + @Override + public void testUploaderVerified() throws Exception { + assertFalse(extractor.isUploaderVerified()); + } } public static class EDMxxx implements BasePlaylistExtractorTest { @@ -310,6 +320,11 @@ public class SoundcloudPlaylistExtractorTest { public void testStreamCount() { assertTrue("Stream count does not fit: " + extractor.getStreamCount(), extractor.getStreamCount() >= 370); } + + @Override + public void testUploaderVerified() throws Exception { + assertFalse(extractor.isUploaderVerified()); + } } public static class SmallPlaylist implements BasePlaylistExtractorTest { @@ -409,5 +424,10 @@ public class SoundcloudPlaylistExtractorTest { public void testStreamCount() { assertEquals(2, extractor.getStreamCount()); } + + @Override + public void testUploaderVerified() throws Exception { + assertFalse(extractor.isUploaderVerified()); + } } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/search/SoundcloudSearchExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/search/SoundcloudSearchExtractorTest.java index 94779f4d..0bd5c0aa 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/search/SoundcloudSearchExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/search/SoundcloudSearchExtractorTest.java @@ -8,14 +8,19 @@ import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.ListExtractor.InfoItemsPage; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.StreamingService; +import org.schabi.newpipe.extractor.channel.ChannelInfoItem; +import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.search.SearchExtractor; import org.schabi.newpipe.extractor.services.DefaultSearchExtractorTest; import javax.annotation.Nullable; +import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; +import java.util.List; import static java.util.Collections.singletonList; +import static org.junit.Assert.assertTrue; import static org.schabi.newpipe.extractor.ServiceList.SoundCloud; import static org.schabi.newpipe.extractor.services.DefaultTests.assertNoDuplicatedItems; import static org.schabi.newpipe.extractor.services.soundcloud.linkHandler.SoundcloudSearchQueryHandlerFactory.*; @@ -139,4 +144,40 @@ public class SoundcloudSearchExtractorTest { throw new RuntimeException(e); } } + + public static class UserVerified extends DefaultSearchExtractorTest { + private static SearchExtractor extractor; + private static final String QUERY = "David Guetta"; + + @BeforeClass + public static void setUp() throws Exception { + NewPipe.init(DownloaderTestImpl.getInstance()); + extractor = SoundCloud.getSearchExtractor(QUERY, singletonList(USERS), ""); + extractor.fetchPage(); + } + + @Override public SearchExtractor extractor() { return extractor; } + @Override public StreamingService expectedService() { return SoundCloud; } + @Override public String expectedName() { return QUERY; } + @Override public String expectedId() { return QUERY; } + @Override public String expectedUrlContains() { return "soundcloud.com/search/users?q=" + urlEncode(QUERY); } + @Override public String expectedOriginalUrlContains() { return "soundcloud.com/search/users?q=" + urlEncode(QUERY); } + @Override public String expectedSearchString() { return QUERY; } + @Nullable @Override public String expectedSearchSuggestion() { return null; } + + @Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.CHANNEL; } + + @Test + public void testIsVerified() throws IOException, ExtractionException { + final List items = extractor.getInitialPage().getItems(); + boolean verified = false; + for (InfoItem item : items) { + if (item.getUrl().equals("https://soundcloud.com/davidguetta")) { + verified = ((ChannelInfoItem) item).isVerified(); + break; + } + } + assertTrue(verified); + } + } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java index b83c1ed0..777a47f8 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java @@ -16,14 +16,10 @@ import java.io.IOException; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl; import static org.schabi.newpipe.extractor.ServiceList.YouTube; -import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestGetPageInNewExtractor; -import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestMoreItems; -import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestRelatedItems; +import static org.schabi.newpipe.extractor.services.DefaultTests.*; /** * Test for {@link ChannelExtractor} @@ -157,6 +153,12 @@ public class YoutubeChannelExtractorTest { assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 0); assertTrue("Subscriber count too small", extractor.getSubscriberCount() >= 4e6); } + + @Override + public void testVerified() throws Exception { + assertTrue(extractor.isVerified()); + } + } // Youtube RED/Premium ad blocking test @@ -250,6 +252,11 @@ public class YoutubeChannelExtractorTest { assertTrue("Subscriber count too small", extractor.getSubscriberCount() >= 10e6); } + @Override + public void testVerified() throws Exception { + assertTrue(extractor.isVerified()); + } + } public static class Kurzgesagt implements BaseChannelExtractorTest { @@ -343,6 +350,11 @@ public class YoutubeChannelExtractorTest { public void testSubscriberCount() throws Exception { assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 5e6); } + + @Override + public void testVerified() throws Exception { + assertTrue(extractor.isVerified()); + } } public static class KurzgesagtAdditional { @@ -453,6 +465,11 @@ public class YoutubeChannelExtractorTest { public void testSubscriberCount() throws Exception { assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 5e5); } + + @Override + public void testVerified() throws Exception { + assertTrue(extractor.isVerified()); + } } public static class RandomChannel implements BaseChannelExtractorTest { @@ -550,6 +567,11 @@ public class YoutubeChannelExtractorTest { long subscribers = extractor.getSubscriberCount(); assertTrue("Wrong subscriber count: " + subscribers, subscribers >= 50); } + + @Override + public void testVerified() throws Exception { + assertFalse(extractor.isVerified()); + } } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java index 0af9ef53..fcec61a1 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java @@ -13,11 +13,7 @@ import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; import org.schabi.newpipe.extractor.services.BasePlaylistExtractorTest; -import org.schabi.newpipe.extractor.services.youtube.YoutubePlaylistExtractorTest.ContinuationsTests; -import org.schabi.newpipe.extractor.services.youtube.YoutubePlaylistExtractorTest.HugePlaylist; -import org.schabi.newpipe.extractor.services.youtube.YoutubePlaylistExtractorTest.LearningPlaylist; -import org.schabi.newpipe.extractor.services.youtube.YoutubePlaylistExtractorTest.NotAvailable; -import org.schabi.newpipe.extractor.services.youtube.YoutubePlaylistExtractorTest.TimelessPopHits; +import org.schabi.newpipe.extractor.services.youtube.YoutubePlaylistExtractorTest.*; import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubePlaylistExtractor; import org.schabi.newpipe.extractor.stream.StreamInfoItem; @@ -39,7 +35,7 @@ import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestRela */ @RunWith(Suite.class) @SuiteClasses({NotAvailable.class, TimelessPopHits.class, HugePlaylist.class, - LearningPlaylist.class, ContinuationsTests.class}) + LearningPlaylist.class, ContinuationsTests.class}) public class YoutubePlaylistExtractorTest { private static final String RESOURCE_PATH = DownloaderFactory.RESOURCE_PATH + "services/youtube/extractor/playlist/"; @@ -163,6 +159,11 @@ public class YoutubePlaylistExtractorTest { public void testStreamCount() throws Exception { assertTrue("Error in the streams count", extractor.getStreamCount() > 100); } + + @Override + public void testUploaderVerified() throws Exception { + assertFalse(extractor.isUploaderVerified()); + } } public static class HugePlaylist implements BasePlaylistExtractorTest { @@ -276,6 +277,11 @@ public class YoutubePlaylistExtractorTest { public void testStreamCount() throws Exception { assertTrue("Error in the streams count", extractor.getStreamCount() > 100); } + + @Override + public void testUploaderVerified() throws Exception { + assertTrue(extractor.isUploaderVerified()); + } } public static class LearningPlaylist implements BasePlaylistExtractorTest { @@ -375,6 +381,11 @@ public class YoutubePlaylistExtractorTest { public void testStreamCount() throws Exception { assertTrue("Error in the streams count", extractor.getStreamCount() > 40); } + + @Override + public void testUploaderVerified() throws Exception { + assertTrue(extractor.isUploaderVerified()); + } } public static class ContinuationsTests { @@ -388,8 +399,8 @@ public class YoutubePlaylistExtractorTest { @Test public void testNoContinuations() throws Exception { final YoutubePlaylistExtractor extractor = (YoutubePlaylistExtractor) YouTube - .getPlaylistExtractor( - "https://www.youtube.com/playlist?list=PLXJg25X-OulsVsnvZ7RVtSDW-id9_RzAO"); + .getPlaylistExtractor( + "https://www.youtube.com/playlist?list=PLXJg25X-OulsVsnvZ7RVtSDW-id9_RzAO"); extractor.fetchPage(); assertNoMoreItems(extractor); @@ -398,12 +409,12 @@ public class YoutubePlaylistExtractorTest { @Test public void testOnlySingleContinuation() throws Exception { final YoutubePlaylistExtractor extractor = (YoutubePlaylistExtractor) YouTube - .getPlaylistExtractor( - "https://www.youtube.com/playlist?list=PLjgwFL8urN2DFRuRkFTkmtHjyoNWHHdZX"); + .getPlaylistExtractor( + "https://www.youtube.com/playlist?list=PLjgwFL8urN2DFRuRkFTkmtHjyoNWHHdZX"); extractor.fetchPage(); final ListExtractor.InfoItemsPage page = defaultTestMoreItems( - extractor); + extractor); assertFalse("More items available when it shouldn't", page.hasNextPage()); } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorTest.java index 0e3222c1..f5737cd9 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorTest.java @@ -13,14 +13,19 @@ import org.schabi.newpipe.extractor.services.DefaultSearchExtractorTest; import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper; import org.schabi.newpipe.extractor.stream.Description; +import org.schabi.newpipe.downloader.DownloaderTestImpl; +import org.schabi.newpipe.extractor.channel.ChannelInfoItem; +import org.schabi.newpipe.extractor.exceptions.ExtractionException; + +import javax.annotation.Nullable; + +import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import javax.annotation.Nullable; - import static java.util.Collections.singletonList; import static junit.framework.TestCase.assertFalse; import static org.junit.Assert.assertEquals; @@ -31,7 +36,6 @@ import static org.schabi.newpipe.extractor.services.DefaultTests.assertNoDuplica import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory.CHANNELS; import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory.PLAYLISTS; import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory.VIDEOS; -import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING; public class YoutubeSearchExtractorTest { @@ -269,4 +273,41 @@ public class YoutubeSearchExtractorTest { @Override public String expectedOriginalUrlContains() throws Exception { return "youtube.com/results?search_query=" + QUERY; } } + + public static class ChannelVerified extends DefaultSearchExtractorTest { + private static SearchExtractor extractor; + private static final String QUERY = "bbc"; + + @BeforeClass + public static void setUp() throws Exception { + NewPipe.init(DownloaderTestImpl.getInstance()); + extractor = YouTube.getSearchExtractor(QUERY, singletonList(CHANNELS), ""); + extractor.fetchPage(); + } + + @Override public SearchExtractor extractor() { return extractor; } + @Override public StreamingService expectedService() { return YouTube; } + @Override public String expectedName() { return QUERY; } + @Override public String expectedId() { return QUERY; } + @Override public String expectedUrlContains() { return "youtube.com/results?search_query=" + QUERY; } + @Override public String expectedOriginalUrlContains() { return "youtube.com/results?search_query=" + QUERY; } + @Override public String expectedSearchString() { return QUERY; } + @Nullable @Override public String expectedSearchSuggestion() { return null; } + @Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.CHANNEL; } + + @Test + public void testAtLeastOneVerified() throws IOException, ExtractionException { + final List items = extractor.getInitialPage().getItems(); + boolean verified = false; + for (InfoItem item : items) { + if (((ChannelInfoItem) item).isVerified()) { + verified = true; + break; + } + } + + assertTrue(verified); + } + } + } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorAgeRestrictedTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorAgeRestrictedTest.java index ca65e36a..63fa3411 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorAgeRestrictedTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorAgeRestrictedTest.java @@ -41,6 +41,7 @@ public class YoutubeStreamExtractorAgeRestrictedTest extends DefaultStreamExtrac @Override public StreamType expectedStreamType() { return StreamType.VIDEO_STREAM; } @Override public String expectedUploaderName() { return "EpicFiveTV"; } @Override public String expectedUploaderUrl() { return "https://www.youtube.com/channel/UCuPUHlLP5POZphOIrjrNxiw"; } + @Override public boolean expectedUploaderVerified() { return true; } @Override public List expectedDescriptionContains() { return Arrays.asList("http://instagram.com/Ruben_Sole", "AVN"); } @Override public long expectedLength() { return 1790; } @Override public long expectedTimestamp() { return TIMESTAMP; } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java index 311725f6..f498a573 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java @@ -103,6 +103,7 @@ public class YoutubeStreamExtractorDefaultTest { return Arrays.asList("https://www.youtube.com/channel/UC7l23W7gFi4Uho6WSzckZRA", "https://www.handcraftpictures.com/"); } + @Override public boolean expectedUploaderVerified() { return true; } @Override public long expectedLength() { return 381; } @Override public long expectedTimestamp() { return TIMESTAMP; } @Override public long expectedViewCountAtLeast() { return 26682500; } @@ -150,6 +151,7 @@ public class YoutubeStreamExtractorDefaultTest { @Nullable @Override public String expectedTextualUploadDate() { return "2018-06-19"; } @Override public long expectedLikeCountAtLeast() { return 340100; } @Override public long expectedDislikeCountAtLeast() { return 18700; } + @Override public boolean expectedUploaderVerified() { return true; } // @formatter:on @Override @Test @@ -271,6 +273,7 @@ public class YoutubeStreamExtractorDefaultTest { @Override public String expectedUploaderName() { return "maiLab"; } @Override public String expectedUploaderUrl() { return "https://www.youtube.com/channel/UCyHDQ5C6z1NDmJ4g6SerW8g"; } @Override public List expectedDescriptionContains() {return Arrays.asList("Vitamin", "2:44", "Was ist Vitamin D?");} + @Override public boolean expectedUploaderVerified() { return true; } @Override public long expectedLength() { return 1010; } @Override public long expectedViewCountAtLeast() { return 815500; } @Nullable @Override public String expectedUploadDate() { return "2020-11-18 00:00:00.000"; } @@ -339,6 +342,7 @@ public class YoutubeStreamExtractorDefaultTest { Collections.singletonList("Wikipedia (German)") )); } + @Override public boolean expectedUploaderVerified() { return true; } // @formatter:on @Override @Ignore("TODO fix") diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorLivestreamTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorLivestreamTest.java index 12a9e1af..47bf775a 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorLivestreamTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorLivestreamTest.java @@ -45,6 +45,7 @@ public class YoutubeStreamExtractorLivestreamTest extends DefaultStreamExtractor return Arrays.asList("https://bit.ly/chilledcow-playlists", "https://bit.ly/chilledcow-submissions"); } + @Override public boolean expectedUploaderVerified() { return true; } @Override public long expectedLength() { return 0; } @Override public long expectedTimestamp() { return TIMESTAMP; } @Override public long expectedViewCountAtLeast() { return 0; }