2016-06-10 86 views
1

我很難找到訪問YouTube視頻評論的方式。 我遇到的最接近的事情告訴我,該功能是一個谷歌+唯一的API調用。 使用 https://developers.google.com/youtube/v3/docs/comments/list#try-it 我得到訪問視頻評論

  • SHOW標題 - { 「錯誤」:{ 「錯誤」:[{ 「域」: 「youtube.comment」, 「理由」:「operationNotSupported 」, 「消息」: 「1D濾波器是隻基於Google+留言兼容」, 「的locationType。」: 「參數」, 「位置」: 「ID」 } ], 「代碼」:400 , 「消息」 :「該ID過濾器只與基於Google+的評論兼容。」 }}

回答

1

您可以使用CommentThreads:list返回匹配的API請求參數,所有的評論線程的列表。

HTTP請求

GET https://www.googleapis.com/youtube/v3/commentThreads 

如果響應是全成,方法返回響應體具有以下結構:

{ 
"kind": "youtube#commentThreadListResponse", 
"etag": etag, 
"nextPageToken": string, 
"pageInfo": { 
"totalResults": integer, 
"resultsPerPage": integer 
}, 
"items": [ 
commentThread Resource 
] 
} 

下面是用不同的支持的編程語言是YouTube API示例代碼: https://developers.google.com/youtube/v3/docs/commentThreads/list#examples

發現這個堆棧溢出相關的票,鐵餅s如何通過YouTube API獲得評論:How to get comments through Youtube Data API v3/JSOUP parsing?

+0

嗨,感謝您的回答,它幾乎可以正常工作,但我發現了一些問題。首先,項目是這樣 「項目」: { 「種」: 「YouTube的#commentThread」, 「ETAG」: 「\」 5g01s4-wS2b4VpScndqCYc5Y-8K/lwxPlgLWRyYfudZ5EW4zKFdXwgk \ 「」, 「ID」: 「z13hxfupbxfqxzwnw23mjzgoftbzczfjr04」 }, { etc .. 而我不知道如何從它得到實際的評論(文本)。 秒數限制爲最多100條評論,但我希望獲得對該視頻的所有評論。 – Athomield

+0

第一個問題已解決,現在如何從視頻中檢索所有沒有100個上限的評論? – Athomield

+0

編輯:上面解決的問題,謝謝你的答案。 – Athomield