Skip to content

Commit

Permalink
Merge pull request #633 from Bnyro/comment-count
Browse files Browse the repository at this point in the history
Add support for extracting the comment count
  • Loading branch information
FireMasterK committed Jun 26, 2023
2 parents f4200da + 1cace30 commit d4d0a40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public static byte[] commentsResponse(String videoId) throws Exception {
nextpage = mapper.writeValueAsString(page);
}

CommentsPage commentsItem = new CommentsPage(comments, nextpage, info.isCommentsDisabled());
CommentsPage commentsItem = new CommentsPage(comments, nextpage, info.isCommentsDisabled(), info.getCommentsCount());

return mapper.writeValueAsBytes(commentsItem);

Expand Down Expand Up @@ -395,7 +395,7 @@ public static byte[] commentsPageResponse(String videoId, String prevpageStr) th
nextpage = mapper.writeValueAsString(page);
}

CommentsPage commentsItem = new CommentsPage(comments, nextpage, false);
CommentsPage commentsItem = new CommentsPage(comments, nextpage, false, -1);

return mapper.writeValueAsBytes(commentsItem);

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/me/kavin/piped/utils/obj/CommentsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ public class CommentsPage {
public List<Comment> comments;
public String nextpage;
public boolean disabled;
public int commentCount;

public CommentsPage(List<Comment> comments, String nextpage, boolean disabled) {
public CommentsPage(List<Comment> comments, String nextpage, boolean disabled, int commentCount) {
this.comments = comments;
this.nextpage = nextpage;
this.disabled = disabled;
this.commentCount = commentCount;
}
}

0 comments on commit d4d0a40

Please sign in to comment.