Deduped code; Using default values...
This commit is contained in:
parent
b934c7ccbb
commit
c3b837fe3b
4 changed files with 31 additions and 76 deletions
|
@ -9,6 +9,7 @@ import org.schabi.newpipe.extractor.utils.Utils;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public interface CommentsInfoItemExtractor extends InfoItemExtractor {
|
public interface CommentsInfoItemExtractor extends InfoItemExtractor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The formatted text (e.g. 420, 4K, 4.2M) of the votes
|
* 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
|
* 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
|
* The upload date given by the service, unmodified
|
||||||
*
|
*
|
||||||
* @see StreamExtractor#getTextualUploadDate()
|
* @see StreamExtractor#getTextualUploadDate()
|
||||||
*/
|
*/
|
||||||
String getTextualUploadDate() throws ParsingException;
|
default String getTextualUploadDate() throws ParsingException {
|
||||||
|
return Utils.EMPTY_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The upload date wrapped with DateWrapper class
|
* The upload date wrapped with DateWrapper class
|
||||||
|
@ -36,28 +41,44 @@ public interface CommentsInfoItemExtractor extends InfoItemExtractor {
|
||||||
* @see StreamExtractor#getUploadDate()
|
* @see StreamExtractor#getUploadDate()
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@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
|
* 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
|
* Whether the comment is pinned
|
||||||
*/
|
*/
|
||||||
boolean isPinned() throws ParsingException;
|
default boolean isPinned() throws ParsingException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the uploader is verified by the service
|
* Whether the uploader is verified by the service
|
||||||
*/
|
*/
|
||||||
boolean isUploaderVerified() throws ParsingException;
|
default boolean isUploaderVerified() throws ParsingException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,6 @@ package org.schabi.newpipe.extractor.services.bandcamp.extractors;
|
||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
import org.schabi.newpipe.extractor.comments.CommentsInfoItemExtractor;
|
import org.schabi.newpipe.extractor.comments.CommentsInfoItemExtractor;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.localization.DateWrapper;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class BandcampCommentsInfoItemExtractor implements CommentsInfoItemExtractor {
|
public class BandcampCommentsInfoItemExtractor implements CommentsInfoItemExtractor {
|
||||||
|
|
||||||
|
@ -37,29 +34,6 @@ public class BandcampCommentsInfoItemExtractor implements CommentsInfoItemExtrac
|
||||||
return writing.getElementsByClass("text").first().ownText();
|
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
|
@Override
|
||||||
public String getUploaderName() throws ParsingException {
|
public String getUploaderName() throws ParsingException {
|
||||||
return writing.getElementsByClass("name").first().text();
|
return writing.getElementsByClass("name").first().text();
|
||||||
|
@ -69,19 +43,4 @@ public class BandcampCommentsInfoItemExtractor implements CommentsInfoItemExtrac
|
||||||
public String getUploaderAvatarUrl() {
|
public String getUploaderAvatarUrl() {
|
||||||
return writing.getElementsByClass("thumb").attr("src");
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,21 +84,6 @@ public class PeertubeCommentsInfoItemExtractor implements CommentsInfoItemExtrac
|
||||||
return baseUrl + value;
|
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
|
@Override
|
||||||
public String getUploaderName() throws ParsingException {
|
public String getUploaderName() throws ParsingException {
|
||||||
return JsonUtils.getString(item, "account.name") + "@" + JsonUtils.getString(item, "account.host");
|
return JsonUtils.getString(item, "account.name") + "@" + JsonUtils.getString(item, "account.host");
|
||||||
|
|
|
@ -38,16 +38,6 @@ public class SoundcloudCommentsInfoItemExtractor implements CommentsInfoItemExtr
|
||||||
return json.getObject("user").getString("avatar_url");
|
return json.getObject("user").getString("avatar_url");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHeartedByUploader() throws ParsingException {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPinned() throws ParsingException {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isUploaderVerified() throws ParsingException {
|
public boolean isUploaderVerified() throws ParsingException {
|
||||||
return json.getObject("user").getBoolean("verified");
|
return json.getObject("user").getBoolean("verified");
|
||||||
|
|
Loading…
Reference in a new issue