このdocumentationから、返信を取得するコメントのIDを指定するparentId
パラメータを使用できます。 YouTubeは現在、トップレベルのコメントのみの返信をサポートしており、返信への返信は将来サポートされる可能性があることに注意してください。 comments.list
メソッドを使用すると、コメントの返信を取得できます。
例:
//Call the YouTube Data API's comments.list method to retrieve existing comment replies.
V3CommentListResponse commentsListResponse = youtube.comments().list("snippet")
.setParentId(parentId).setTextFormat("plainText").execute();
List<Comment> comments = commentsListResponse.getItems();
if (comments.isEmpty()) {
System.out.println("Can't get comment replies.");
} else {
// Print information from the API response.
System.out.println("\n===========Returned Comment Replies============\n");
for (Comment commentReply : comments) {
snippet = commentReply.getSnippet();
System.out.println(" - Author: " + snippet.getAuthorDisplayName());
System.out.println(" - Comment: " + snippet.getTextDisplay());
System.out.println("\n---------------\n");
}
Comment firstCommentReply = comments.get(0);
firstCommentReply.getSnippet().setTextOriginal("updated");
Comment commentUpdateResponse = youtube.comments()
.update("snippet", firstCommentReply).execute();
// Print information from the API response.
System.out.println("\n============Updated Video Comment===============\n");
snippet = commentUpdateResponse.getSnippet();
System.out.println(" - Author: " + snippet.getAuthorDisplayName());
System.out.println(" - Comment: " + snippet.getTextDisplay());
System.out.println("\n--------------------------------\n");
この関連threadにチェックします。