Skip to content

Commit c3b837f

Browse files
committed
Deduped code; Using default values...
1 parent b934c7c commit c3b837f

4 files changed

Lines changed: 31 additions & 76 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/comments/CommentsInfoItemExtractor.java

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import javax.annotation.Nullable;
1010

1111
public interface CommentsInfoItemExtractor extends InfoItemExtractor {
12+
1213
/**
1314
* The formatted text (e.g. 420, 4K, 4.2M) of the votes
1415
*
@@ -21,43 +22,63 @@ default String getTextualVoteCount() throws ParsingException {
2122
/**
2223
* The text of the comment
2324
*/
24-
String getCommentText() throws ParsingException;
25+
default String getCommentText() throws ParsingException {
26+
return Utils.EMPTY_STRING;
27+
}
2528

2629
/**
2730
* The upload date given by the service, unmodified
2831
*
2932
* @see StreamExtractor#getTextualUploadDate()
3033
*/
31-
String getTextualUploadDate() throws ParsingException;
34+
default String getTextualUploadDate() throws ParsingException {
35+
return Utils.EMPTY_STRING;
36+
}
3237

3338
/**
3439
* The upload date wrapped with DateWrapper class
3540
*
3641
* @see StreamExtractor#getUploadDate()
3742
*/
3843
@Nullable
39-
DateWrapper getUploadDate() throws ParsingException;
44+
default DateWrapper getUploadDate() throws ParsingException {
45+
return null;
46+
}
4047

41-
String getCommentId() throws ParsingException;
48+
default String getCommentId() throws ParsingException {
49+
return Utils.EMPTY_STRING;
50+
}
4251

43-
String getUploaderUrl() throws ParsingException;
52+
default String getUploaderUrl() throws ParsingException {
53+
return Utils.EMPTY_STRING;
54+
}
4455

45-
String getUploaderName() throws ParsingException;
56+
default String getUploaderName() throws ParsingException {
57+
return Utils.EMPTY_STRING;
58+
}
4659

47-
String getUploaderAvatarUrl() throws ParsingException;
60+
default String getUploaderAvatarUrl() throws ParsingException {
61+
return Utils.EMPTY_STRING;
62+
}
4863

4964
/**
5065
* Whether the comment has been hearted by the uploader
5166
*/
52-
boolean isHeartedByUploader() throws ParsingException;
67+
default boolean isHeartedByUploader() throws ParsingException {
68+
return false;
69+
}
5370

5471
/**
5572
* Whether the comment is pinned
5673
*/
57-
boolean isPinned() throws ParsingException;
74+
default boolean isPinned() throws ParsingException {
75+
return false;
76+
}
5877

5978
/**
6079
* Whether the uploader is verified by the service
6180
*/
62-
boolean isUploaderVerified() throws ParsingException;
81+
default boolean isUploaderVerified() throws ParsingException {
82+
return false;
83+
}
6384
}

extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampCommentsInfoItemExtractor.java

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
import org.jsoup.nodes.Element;
44
import org.schabi.newpipe.extractor.comments.CommentsInfoItemExtractor;
55
import org.schabi.newpipe.extractor.exceptions.ParsingException;
6-
import org.schabi.newpipe.extractor.localization.DateWrapper;
7-
8-
import javax.annotation.Nullable;
96

107
public class BandcampCommentsInfoItemExtractor implements CommentsInfoItemExtractor {
118

@@ -37,29 +34,6 @@ public String getCommentText() {
3734
return writing.getElementsByClass("text").first().ownText();
3835
}
3936

40-
@Override
41-
public String getTextualUploadDate() {
42-
return "";
43-
}
44-
45-
@Nullable
46-
@Override
47-
public DateWrapper getUploadDate() {
48-
return null;
49-
}
50-
51-
@Override
52-
public String getCommentId() {
53-
return "";
54-
}
55-
56-
@Override
57-
public String getUploaderUrl() {
58-
//return writing.getElementsByClass("name").attr("href");
59-
// Fan links cannot be opened
60-
return "";
61-
}
62-
6337
@Override
6438
public String getUploaderName() throws ParsingException {
6539
return writing.getElementsByClass("name").first().text();
@@ -69,19 +43,4 @@ public String getUploaderName() throws ParsingException {
6943
public String getUploaderAvatarUrl() {
7044
return writing.getElementsByClass("thumb").attr("src");
7145
}
72-
73-
@Override
74-
public boolean isHeartedByUploader() {
75-
return false;
76-
}
77-
78-
@Override
79-
public boolean isPinned() {
80-
return false;
81-
}
82-
83-
@Override
84-
public boolean isUploaderVerified() throws ParsingException {
85-
return false;
86-
}
8746
}

extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeCommentsInfoItemExtractor.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,6 @@ public String getUploaderAvatarUrl() {
8484
return baseUrl + value;
8585
}
8686

87-
@Override
88-
public boolean isHeartedByUploader() throws ParsingException {
89-
return false;
90-
}
91-
92-
@Override
93-
public boolean isPinned() throws ParsingException {
94-
return false;
95-
}
96-
97-
@Override
98-
public boolean isUploaderVerified() throws ParsingException {
99-
return false;
100-
}
101-
10287
@Override
10388
public String getUploaderName() throws ParsingException {
10489
return JsonUtils.getString(item, "account.name") + "@" + JsonUtils.getString(item, "account.host");

extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudCommentsInfoItemExtractor.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,6 @@ public String getUploaderAvatarUrl() {
3838
return json.getObject("user").getString("avatar_url");
3939
}
4040

41-
@Override
42-
public boolean isHeartedByUploader() throws ParsingException {
43-
return false;
44-
}
45-
46-
@Override
47-
public boolean isPinned() throws ParsingException {
48-
return false;
49-
}
50-
5141
@Override
5242
public boolean isUploaderVerified() throws ParsingException {
5343
return json.getObject("user").getBoolean("verified");

0 commit comments

Comments
 (0)