2016-07-17 3 views
1

나는 youtube 비디오에서 의견을 추출하려고합니다. 주석 (https://developers.google.com/youtube/v3/docs/commentThreads/list#try-it)을 검색 할 수 있지만 개별 주석의 응답을 검색하는 방법을 식별 할 수는 없습니다. Youtube API 문서를 살펴 보았지만 댓글 응답을 검색하는 방법을 정확히 찾아 낼 수는 없습니다. 아무도 그것이 가능하다면 알려주실 수 있습니까? 그렇다면 어떻게해야합니까? 감사.검색 Youtube 댓글 답글

답변

0

documentation에서, 당신은 응답을 검색해야하는 주석의 ID를 지정하는 parentId 매개 변수를 사용할 수 있습니다. YouTube는 현재 최상위 수준의 댓글에 대해서만 답장을 지원하고 답변에 대한 답장은 향후 지원 될 수 있습니다. comments.list 메소드를 사용하여 댓글 답글을 검색 할 수 있습니다.

예 :이 관련 thread

//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"); 

확인합니다.