mirror of
https://github.com/TeamNewPipe/NewPipeExtractor
synced 2025-08-31 06:15:37 +00:00
Add comment replies.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.schabi.newpipe.extractor.comments;
|
||||
|
||||
import org.schabi.newpipe.extractor.InfoItemExtractor;
|
||||
import org.schabi.newpipe.extractor.Page;
|
||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||
import org.schabi.newpipe.extractor.localization.DateWrapper;
|
||||
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeCommentsInfoItemExtractor;
|
||||
@@ -107,4 +108,13 @@ public interface CommentsInfoItemExtractor extends InfoItemExtractor {
|
||||
default int getStreamPosition() throws ParsingException {
|
||||
return CommentsInfoItem.NO_STREAM_POSITION;
|
||||
}
|
||||
|
||||
/**
|
||||
* The continuation page which is used to get comment replies from.
|
||||
* @return the continuation Page for the replies
|
||||
*/
|
||||
@Nullable
|
||||
default Page getReplies() throws ParsingException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ package org.schabi.newpipe.extractor.services.youtube.extractors;
|
||||
import com.grack.nanojson.JsonArray;
|
||||
import com.grack.nanojson.JsonObject;
|
||||
|
||||
import org.schabi.newpipe.extractor.Page;
|
||||
import org.schabi.newpipe.extractor.comments.CommentsInfoItemExtractor;
|
||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||
import org.schabi.newpipe.extractor.localization.DateWrapper;
|
||||
@@ -230,4 +231,14 @@ public class YoutubeCommentsInfoItemExtractor implements CommentsInfoItemExtract
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page getReplies() throws ParsingException {
|
||||
try {
|
||||
final String id = JsonUtils.getString(JsonUtils.getArray(json, "replies.commentRepliesRenderer.contents").getObject(0), "continuationItemRenderer.continuationEndpoint.continuationCommand.token");
|
||||
return new Page(url, id);
|
||||
} catch (final Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user