Skip to content

Commit 08f6570

Browse files
committed
Add isLiveChat flag to CommentsExtractor
1 parent cb82024 commit 08f6570

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ public boolean isCommentsDisabled() throws ExtractionException {
2222
return false;
2323
}
2424

25+
/**
26+
* @apiNote Warning: This method is experimental and may get removed in a future release.
27+
* @return <code>true</code> if the comments source is a live chat otherwise <code>false</code> (default)
28+
*/
29+
public boolean isLiveChat() throws ExtractionException {
30+
return false;
31+
}
32+
2533
/**
2634
* @return the total number of comments
2735
*/

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public static CommentsInfo getInfo(final CommentsExtractor commentsExtractor)
4747
final InfoItemsPage<CommentsInfoItem> initialCommentsPage =
4848
ExtractorHelper.getItemsPageOrLogError(commentsInfo, commentsExtractor);
4949
commentsInfo.setCommentsDisabled(commentsExtractor.isCommentsDisabled());
50+
commentsInfo.setLiveChat(commentsExtractor.isLiveChat());
5051
commentsInfo.setRelatedItems(initialCommentsPage.getItems());
5152
try {
5253
commentsInfo.setCommentsCount(commentsExtractor.getCommentsCount());
@@ -81,6 +82,7 @@ public static InfoItemsPage<CommentsInfoItem> getMoreItems(
8182

8283
private transient CommentsExtractor commentsExtractor;
8384
private boolean commentsDisabled = false;
85+
private boolean liveChat = false;
8486
private int commentsCount;
8587

8688
public CommentsExtractor getCommentsExtractor() {
@@ -106,6 +108,22 @@ public void setCommentsDisabled(final boolean commentsDisabled) {
106108
this.commentsDisabled = commentsDisabled;
107109
}
108110

111+
/**
112+
* @apiNote Warning: This method is experimental and may get removed in a future release.
113+
* @return {@code true} if the comments are from a live chat otherwise {@code false} (default)
114+
*/
115+
public boolean isLiveChat() {
116+
return liveChat;
117+
}
118+
119+
/**
120+
* @apiNote Warning: This method is experimental and may get removed in a future release.
121+
* @param liveChat {@code true} if the comments are from a live chat otherwise {@code false}
122+
*/
123+
public void setLiveChat(final boolean liveChat) {
124+
this.liveChat = liveChat;
125+
}
126+
109127
/**
110128
* Returns the total number of comments.
111129
*

0 commit comments

Comments
 (0)