我在 node.js 中使用 youtube 資料 api v3,從視頻中獲取評論執行緒時,結果集長度不一致。
https://developers.google.com/youtube/v3/docs/commentThreads/list
當我使用代碼查詢 ID 為“dtfW6EP91fY”的視頻時
var service = google.youtube('v3');
service.commentThreads.list({
auth: auth,
part: "id,snippet,replies",
videoId: "dtfW6EP91fY",
order: "relevance",
maxResults: 100,
pageToken
}, (err, response) => {
});
(在每個回應中,我保存下一個令牌并將其設定回用于下一次呼叫)
但我得到奇怪的結果集。我首先看到 100 條評論,然后我看到 1 條評論,然后我看到 100 條評論,然后是 1 條,并且一直在交替。
不僅如此,對于獲得 1 個結果的回應,下一頁標記也未定義。
如何獲得一致的 100 條評論?
uj5u.com熱心網友回復:
根據 YouTube,您的視頻dtfW6EP91fY有 308 條評論。但是,您只能通過CommentThreads: list檢索 101 條評論,這很正常。
使用CommentThreads 時的回復:串列最多給出 5 個回復。如果訊息有超過 5 個回復,您必須使用Comments: list將它們全部列出。這就是為什么你錯過了很多評論。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/459816.html
