Add constant NO_LIKE_COUNT to CommentsInfoItem

This commit is contained in:
TobiGr 2021-06-06 11:24:22 +02:00
parent b70c0f93c7
commit f7f727d19c
2 changed files with 12 additions and 2 deletions

View File

@ -22,6 +22,7 @@ public class CommentsInfoItem extends InfoItem {
private boolean pinned; private boolean pinned;
private int streamPosition; private int streamPosition;
public static final int NO_LIKE_COUNT = -1;
public static final int NO_STREAM_POSITION = -1; public static final int NO_STREAM_POSITION = -1;
public CommentsInfoItem(int serviceId, String url, String name) { public CommentsInfoItem(int serviceId, String url, String name) {
@ -85,6 +86,10 @@ public class CommentsInfoItem extends InfoItem {
this.uploadDate = uploadDate; this.uploadDate = uploadDate;
} }
/**
* @return the comment's like count
* or {@link CommentsInfoItem#NO_LIKE_COUNT} if it is unavailable
*/
public int getLikeCount() { public int getLikeCount() {
return likeCount; return likeCount;
} }

View File

@ -12,15 +12,20 @@ import javax.annotation.Nullable;
public interface CommentsInfoItemExtractor extends InfoItemExtractor { public interface CommentsInfoItemExtractor extends InfoItemExtractor {
/** /**
* Return the like count of the comment, or -1 if it's unavailable * Return the like count of the comment,
* or {@link CommentsInfoItem#NO_LIKE_COUNT} if it is unavailable.
*
* <br> * <br>
*
* NOTE: Currently only implemented for YT {@link YoutubeCommentsInfoItemExtractor#getLikeCount()} * NOTE: Currently only implemented for YT {@link YoutubeCommentsInfoItemExtractor#getLikeCount()}
* with limitations (only approximate like count is returned) * with limitations (only approximate like count is returned)
* *
* @see StreamExtractor#getLikeCount() * @see StreamExtractor#getLikeCount()
* @return the comment's like count
* or {@link CommentsInfoItem#NO_LIKE_COUNT} if it is unavailable
*/ */
default int getLikeCount() throws ParsingException { default int getLikeCount() throws ParsingException {
return -1; return CommentsInfoItem.NO_LIKE_COUNT;
} }
/** /**