Skip to content

Commit f7f727d

Browse files
committed
Add constant NO_LIKE_COUNT to CommentsInfoItem
1 parent b70c0f9 commit f7f727d

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class CommentsInfoItem extends InfoItem {
2222
private boolean pinned;
2323
private int streamPosition;
2424

25+
public static final int NO_LIKE_COUNT = -1;
2526
public static final int NO_STREAM_POSITION = -1;
2627

2728
public CommentsInfoItem(int serviceId, String url, String name) {
@@ -85,6 +86,10 @@ public void setUploadDate(@Nullable DateWrapper uploadDate) {
8586
this.uploadDate = uploadDate;
8687
}
8788

89+
/**
90+
* @return the comment's like count
91+
* or {@link CommentsInfoItem#NO_LIKE_COUNT} if it is unavailable
92+
*/
8893
public int getLikeCount() {
8994
return likeCount;
9095
}

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@
1212
public interface CommentsInfoItemExtractor extends InfoItemExtractor {
1313

1414
/**
15-
* Return the like count of the comment, or -1 if it's unavailable
15+
* Return the like count of the comment,
16+
* or {@link CommentsInfoItem#NO_LIKE_COUNT} if it is unavailable.
17+
*
1618
* <br>
19+
*
1720
* NOTE: Currently only implemented for YT {@link YoutubeCommentsInfoItemExtractor#getLikeCount()}
1821
* with limitations (only approximate like count is returned)
1922
*
2023
* @see StreamExtractor#getLikeCount()
24+
* @return the comment's like count
25+
* or {@link CommentsInfoItem#NO_LIKE_COUNT} if it is unavailable
2126
*/
2227
default int getLikeCount() throws ParsingException {
23-
return -1;
28+
return CommentsInfoItem.NO_LIKE_COUNT;
2429
}
2530

2631
/**

0 commit comments

Comments
 (0)