视频评论列表
获取YouTube视频的一级评论,支持排序、区域设置选项和游标分页。用于查看观众讨论或继续浏览其他评论页面。
参数
| 参数 | 必填 | 类型 | 说明 | 示例 | 可选值 |
|---|---|---|---|---|---|
video_id |
必填 | string | YouTube视频的唯一标识符。 | dQw4w9WgXcQ |
— |
cursor |
可选 | string | 由先前响应返回的分页游标。 | — | — |
language_code |
可选 | string | 响应数据的语言偏好。 | zh-CN |
— |
country_code |
可选 | string | 响应数据的地区代码。 | US |
— |
sort_by |
可选 | string | 评论列表的排序方式。 可选值: - `top`:热门评论 - `newest`:最新评论 | newest |
topnewest |
代码示例
curl -G "https://api.mofa-ai.com/v1/youtube/get_video_comment_v1" \
-H "Authorization: Bearer $MOFA_API_KEY" \
--data-urlencode 'video_id=dQw4w9WgXcQ' \
--data-urlencode 'language_code=zh-CN' \
--data-urlencode 'country_code=US' \
--data-urlencode 'sort_by=newest'
import os
import requests
resp = requests.get(
"https://api.mofa-ai.com/v1/youtube/get_video_comment_v1",
headers={"Authorization": f"Bearer {os.environ['MOFA_API_KEY']}"},
params={
"video_id": "dQw4w9WgXcQ",
"language_code": "zh-CN",
"country_code": "US",
"sort_by": "newest",
},
timeout=60,
)
body = resp.json()
if body["success"]:
print(body["cost_usd"], body["data"])
else:
print(body["error"], body["message"])
const url = new URL("https://api.mofa-ai.com/v1/youtube/get_video_comment_v1");
url.search = new URLSearchParams({
video_id: "dQw4w9WgXcQ",
language_code: "zh-CN",
country_code: "US",
sort_by: "newest",
});
const resp = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.MOFA_API_KEY}` },
});
const body = await resp.json();
if (body.success) console.log(body.cost_usd, body.data);
else console.error(body.error, body.message);
在线试用
登录后可以在这里直接调用此接口,按价格从余额扣费,失败不收费。新账户赠送 $0.50 试用额度。
响应示例
采集于 2026-11-08,耗时 2699 ms · 请求参数 {"sort_by": "newest", "video_id": "dQw4w9WgXcQ", "country_code": "US", "language_code": "zh-CN"}
JSON
{
"success": true,
"code": 0,
"message": "success",
"request_id": "req_5f1c2a9be04d7c3a81f6e2d0",
"endpoint": "youtube.get_video_comment_v1",
"cost_usd": 0.02,
"data": {
"code": 0,
"data": {
"comments": [
{
"author": {
"is_artist": false,
"avatar_url": "https://yt3.ggpht.com/ePcCQBufb2-9s7lUpZzYzrRIatwmIvQ4UiK_zYbzOVVhumRZtx4zJVrWGKz0VUQ-atYo2Nx8Og=s88-c-k-c0x00ffffff-no-rj",
"channel_id": "UCz65dwQtAGRm12jzti0Ou1Q",
"is_creator": false,
"channel_url": "https://www.youtube.com/@RawbCool7",
"is_verified": false,
"display_name": "@RawbCool7",
"avatar_thumbnails": null
},
"content": "imma smoke weed to this song and not care about people vro.",
"comment_id": "UgyAqd4ONIGwmbhiV894AaABAg",
"like_count": "1",
"reply_count": "0",
"reply_level": 0,
"published_time": "2分钟前",
"like_count_a11y": "1 次赞",
"reply_count_a11y": "0 条回复",
"creator_thumbnail_url": null
},
{
"author": {
"is_artist": false,
"avatar_url": "https://yt3.ggpht.com/seetDKgWFFAm7ESQeeM4pmiB7TXmayeo9l0aWhHMTNxVHD5PN27gCVjQpM2wpHfMNbiBfa0B=s88-c-k-c0x00ffffff-no-rj",
"channel_id": "UC1H0I_PKw0PFdzQQM3jVQkw",
"is_creator": false,
"channel_url": "https://www.youtube.com/@%D0%92%D0%BE%D1%82%D0%BA%D0%BD%D1%83%D0%BB",
"is_verified": false,
"display_name": "@Воткнул",
"avatar_thumbnails": null
},
"content": "get rickrolled again…",
"comment_id": "UgzIR1QntbHnTgDF0iR4AaABAg",
"like_count": "0",
"reply_count": "0",
"reply_level": 0,
"published_time": "6分钟前",
"like_count_a11y": "0 次赞",
"reply_count_a11y": "0 条回复",
"creator_thumbnail_url": null
},
"… +18"
],
"continuation_token": "Eg0SC2RRdzR3OVdnWGNRGAYyuAEKfGdldF9uZXdlc3RfZmlyc3QtLUNnZ0lnQVFWRjdmUk9CSUZDSjBnR0FFU0JRaW9JQmdBRWdVSWlDQVlBQklGQ0lrZ0dBQVNCUWlISUJnQUVnVUluaUFZQUJJRkNNZ2dHQUFpRGdvTUNLYVZ2dGNHRUlDRHplQUJVQUJZQVEiESIL…"
},
"message": null,
"requestId": "7bbdb021dd9449398fd948129c7976c3",
"recordTime": "2026-11-08T08:00:12.353266636",
"requestParams": {
"body": null,
"query": {
"sortBy": "newest",
"videoId": "dQw4w9WgXcQ",
"countryCode": "US",
"languageCode": "zh-CN"
}
}
}
}