diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/comments/CommentsInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/comments/CommentsInfoItemExtractor.java index 679cee61..db5ce2c7 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/comments/CommentsInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/comments/CommentsInfoItemExtractor.java @@ -9,6 +9,7 @@ import org.schabi.newpipe.extractor.utils.Utils; import javax.annotation.Nullable; public interface CommentsInfoItemExtractor extends InfoItemExtractor { + /** * The formatted text (e.g. 420, 4K, 4.2M) of the votes * @@ -21,14 +22,18 @@ public interface CommentsInfoItemExtractor extends InfoItemExtractor { /** * The text of the comment */ - String getCommentText() throws ParsingException; + default String getCommentText() throws ParsingException { + return Utils.EMPTY_STRING; + } /** * The upload date given by the service, unmodified * * @see StreamExtractor#getTextualUploadDate() */ - String getTextualUploadDate() throws ParsingException; + default String getTextualUploadDate() throws ParsingException { + return Utils.EMPTY_STRING; + } /** * The upload date wrapped with DateWrapper class @@ -36,28 +41,44 @@ public interface CommentsInfoItemExtractor extends InfoItemExtractor { * @see StreamExtractor#getUploadDate() */ @Nullable - DateWrapper getUploadDate() throws ParsingException; + default DateWrapper getUploadDate() throws ParsingException { + return null; + } - String getCommentId() throws ParsingException; + default String getCommentId() throws ParsingException { + return Utils.EMPTY_STRING; + } - String getUploaderUrl() throws ParsingException; + default String getUploaderUrl() throws ParsingException { + return Utils.EMPTY_STRING; + } - String getUploaderName() throws ParsingException; + default String getUploaderName() throws ParsingException { + return Utils.EMPTY_STRING; + } - String getUploaderAvatarUrl() throws ParsingException; + default String getUploaderAvatarUrl() throws ParsingException { + return Utils.EMPTY_STRING; + } /** * Whether the comment has been hearted by the uploader */ - boolean isHeartedByUploader() throws ParsingException; + default boolean isHeartedByUploader() throws ParsingException { + return false; + } /** * Whether the comment is pinned */ - boolean isPinned() throws ParsingException; + default boolean isPinned() throws ParsingException { + return false; + } /** * Whether the uploader is verified by the service */ - boolean isUploaderVerified() throws ParsingException; + default boolean isUploaderVerified() throws ParsingException { + return false; + } } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampCommentsInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampCommentsInfoItemExtractor.java index bdd51b40..4c077f74 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampCommentsInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampCommentsInfoItemExtractor.java @@ -3,9 +3,6 @@ package org.schabi.newpipe.extractor.services.bandcamp.extractors; import org.jsoup.nodes.Element; import org.schabi.newpipe.extractor.comments.CommentsInfoItemExtractor; import org.schabi.newpipe.extractor.exceptions.ParsingException; -import org.schabi.newpipe.extractor.localization.DateWrapper; - -import javax.annotation.Nullable; public class BandcampCommentsInfoItemExtractor implements CommentsInfoItemExtractor { @@ -37,29 +34,6 @@ public class BandcampCommentsInfoItemExtractor implements CommentsInfoItemExtrac return writing.getElementsByClass("text").first().ownText(); } - @Override - public String getTextualUploadDate() { - return ""; - } - - @Nullable - @Override - public DateWrapper getUploadDate() { - return null; - } - - @Override - public String getCommentId() { - return ""; - } - - @Override - public String getUploaderUrl() { - //return writing.getElementsByClass("name").attr("href"); - // Fan links cannot be opened - return ""; - } - @Override public String getUploaderName() throws ParsingException { return writing.getElementsByClass("name").first().text(); @@ -69,19 +43,4 @@ public class BandcampCommentsInfoItemExtractor implements CommentsInfoItemExtrac public String getUploaderAvatarUrl() { return writing.getElementsByClass("thumb").attr("src"); } - - @Override - public boolean isHeartedByUploader() { - return false; - } - - @Override - public boolean isPinned() { - return false; - } - - @Override - public boolean isUploaderVerified() throws ParsingException { - return false; - } } 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 07c14191..a1de7934 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 @@ -84,21 +84,6 @@ public class PeertubeCommentsInfoItemExtractor implements CommentsInfoItemExtrac return baseUrl + value; } - @Override - public boolean isHeartedByUploader() throws ParsingException { - return false; - } - - @Override - public boolean isPinned() throws ParsingException { - 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/soundcloud/extractors/SoundcloudCommentsInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudCommentsInfoItemExtractor.java index b2643ae5..2b006962 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 @@ -38,16 +38,6 @@ public class SoundcloudCommentsInfoItemExtractor implements CommentsInfoItemExtr return json.getObject("user").getString("avatar_url"); } - @Override - public boolean isHeartedByUploader() throws ParsingException { - return false; - } - - @Override - public boolean isPinned() throws ParsingException { - return false; - } - @Override public boolean isUploaderVerified() throws ParsingException { return json.getObject("user").getBoolean("verified");