video_idstring必須
**Purpose**: Video ID
https://api.sandbase.ai/v1/api/youtube/web-v2/video-commentsRetrieves top-level comments for a YouTube video specified by video ID. Supports sorting by top or newest, regional localization, and pagination.
[
{
"data": {
"comments": [
{
"author": {
"avatar_thumbnails": null,
"avatar_url": "https://yt3.ggpht.com/3s6evpqAiDU9tQR4sC2siJippbH2RWVPnwHgyl4V0th2iuQz0VDQZbUhQBGmsxLYo-mjG6TqZQ=s88-c-k-c0x00ffffff-no-rj",
"channel_id": "UCBR8-60-B28hp2BmDPdntcQ",
"channel_url": "https://www.youtube.com/@YouTube",
"display_name": "@YouTube",
"is_artist": false,
"is_creator": false,
"is_verified": true
},
"comment_id": "Ugzge340dBgB75hWBm54AaABAg",
"content": "can confirm: he never gave us up",
"creator_thumbnail_url": "https://yt3.ggpht.com/_ShEGOdg-t5YGJse14Ooq6FYBZqX_QSlhaTNjG06miYusm5lWm1UroLyVxnYtahADfRTVLtuVQ=s88-c-k-c0x00ffffff-no-rj",
"like_count": "32万",
"like_count_a11y": "32万 次赞",
"published_time": "1年前",
"reply_continuation_token": "Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd6Z2UzNDBkQmdCNzVoV0JtNTRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3pnZTM0MGRCZ0I3NWhXQm01NEFhQUJBZw%3D%3D",
"reply_count": "961",
"reply_count_a11y": "961 条回复",
"reply_count_text": "961 条回复",
"reply_level": 0
},
{
"author": {
"avatar_thumbnails": null,
"avatar_url": "https://yt3.ggpht.com/ytc/AIdro_kDD-FhIbth2qcBbI9VGxR41dJa0kE3kN9iVlGzNgRU_g=s88-c-k-c0x00ffffff-no-rj",
"channel_id": "UCKrzgYonJnMd0Dk7zQXjYXw",
"channel_url": "https://www.youtube.com/@grustache4569",
"display_name": "@grustache4569",
"is_artist": false,
"is_creator": false,
"is_verified": false
},
"comment_id": "UgzKYksqeQ5gA3t0g0F4AaABAg",
"content": "I Rick rolled my entire French class because we had to study a city in France and make a quiz about it as well as a presentation, I decided to make a Kahoot quiz because it’s very easy. I put a link in to this saying it’s the kahoot link. The teacher needless to say got very very mad. As well as my classmates asking who rick rolls in 2019",
"creator_thumbnail_url": null,
"like_count": "10万",
"like_count_a11y": "10万 次赞",
"published_time": "6年前(修改过)",
"reply_continuation_token": "Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd6S1lrc3FlUTVnQTN0MGcwRjRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3pLWWtzcWVRNWdBM3QwZzBGNEFhQUJBZw%3D%3D",
"reply_count": "579",
"reply_count_a11y": "579 条回复",
"reply_count_text": "579 条回复",
"reply_level": 0
},
{
"author": {
"avatar_thumbnails": null,
"avatar_url": "https://yt3.ggpht.com/ytc/AIdro_kcDoQJUNDkDzTrA5kaF5ADVujN-6UcDjMP2Kydtw=s88-c-k-c0x00ffffff-no-rj",
"channel_id": "UCdi6tGxvFvTRGe-7dAn7m7w",
"channel_url": "https://www.youtube.com/@bdr8823",
"display_name": "@bdr8823",
"is_artist": false,
"is_creator": false,
"is_verified": false
},
"comment_id": "UgwPwTibxdgqCHZxktd4AaABAg",
"content": "My algebra teacher said that this was a link to the test answers",
"creator_thumbnail_url": null,
"like_count": "6.8万",
"like_count_a11y": "6.8万 次赞",
"published_time": "7年前",
"reply_continuation_token": "Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd3UHdUaWJ4ZGdxQ0haeGt0ZDRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3dQd1RpYnhkZ3FDSFp4a3RkNEFhQUJBZw%3D%3D",
"reply_count": "609",
"reply_count_a11y": "609 条回复",
"reply_count_text": "609 条回复",
"reply_level": 0
},
"… 17 more items in the full response"
],
"continuation_token": "Eg0SC2RRdzR3OVdnWGNRGAYymQMK3AJnZXRfcmFua2VkX3N0cmVhbXMtLUNxZ0JDSUFFRlJlMzBUZ2FuUUVLbUFFSTJGOFFnQVFZQnlLTkFmdVNwRWFFcU12eXFYV19RcDRxMC1XSVBSVmEtd2dRSkZZSkUzVjNEUEZKSGxSZC1WM1dncEk5dFl2SzVqTkFFU2lWS19IVWdjOGNWOVpFck52cUZXNlNSbDBsc2RqYUhvUG9XamxCNmJNS0lqaTVxRnlNbldnYzlrR0d6aFRsQW43RFVZWWUwMGFvbG1uaW5LWmdIQ0dLUVdGcnpfTDE4Z1ljc2pmdGloVUstWVFsTWVZb0Yyb3NBbXJTQWhBVUVnY0loeUFRQVJnQUVnY0loQ0FRRHhnQkVnY0lpU0FRQVJnQUVnVUlxQ0FZQUJJRkNNQWdHQUFTQlFpSUlCZ0FFZ2NJaFNBUUJCZ0JFZ1VJdXlBWUFCSUZDSVlnR0FCUUFGZ0IiESILZFF3NHc5V2dYY1EwAHgBKBQwAUIhZW5nYWdlbWVudC1wYW5lbC1jb21tZW50cy1zZWN0aW9u"
}
}
]例を選択すると、その入力と結果がプレイグラウンドに読み込まれます。
Returns top-level comments for a YouTube video, with author details, like and reply counts, and a publish time for each comment. The only required input is the 11-character video_id.
sort_by set to newest to feed a moderation queue.curl -X POST "https://api.sandbase.ai/v1/api/youtube/web-v2/video-comments" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"video_id": "dQw4w9WgXcQ"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
video_id | string | Yes | Purpose: Video ID |
continuation_token | string | No | Purpose: Pagination token for next page |
country_code | string | No | Purpose: Set region code |
language_code | string | No | Purpose: Set language preference for comments |
need_format | boolean | No | Purpose: Whether to return cleaned simplified data |
sort_by | string | No | Purpose: Comment sorting method |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"comments": [
{
"author": {
"avatar_thumbnails": null,
"avatar_url": "https://yt3.ggpht.com/ytc/AIdro_kDD-FhIbth2qcBbI9VGxR41dJa0kE3kN9iVlGzNgRU_g=s88…",
"channel_id": "UCKrzgYonJnMd0Dk7zQXjYXw",
"channel_url": "https://www.youtube.com/@grustache4569",
"display_name": "@grustache4569",
"is_artist": false,
"is_creator": false,
"is_verified": false
},
"comment_id": "UgzKYksqeQ5gA3t0g0F4AaABAg",
"content": "I Rick rolled my entire French class because we had to study a city in France an…",
"creator_thumbnail_url": null,
"like_count": "10万",
"like_count_a11y": "10万 次赞",
"published_time": "6年前(修改过)",
"reply_continuation_token": "Eg0SC2RR…",
"reply_count": "665",
"reply_count_a11y": "665 条回复",
"reply_count_text": "665 条回复",
"reply_level": 0
}
],
"continuation_token": "Eg0SC2RR…"
}
| Field | Meaning |
|---|---|
comments[].comment_id | ID of the comment. |
comments[].content | Text of the comment. Long comments may be shortened. |
comments[].like_count / comments[].like_count_a11y | Like count as a display string, such as 10万. The a11y version adds a text label. Both follow the language set by language_code. |
comments[].reply_count / comments[].reply_count_text | Number of replies to the comment, as a display string. The text version adds a label. |
comments[].published_time | Relative time the comment was posted, such as 6年前. A suffix marks comments that were edited. |
comments[].author.display_name | Handle of the commenter, such as @grustache4569. |
comments[].author.channel_id / comments[].author.channel_url | ID and URL of the commenter's YouTube channel. |
comments[].author.is_creator / comments[].author.is_verified / comments[].author.is_artist | Flags that show whether the commenter is the video creator, verified, or an artist. |
comments[].reply_continuation_token | Token tied to this comment. Use it to load the replies to this comment. |
continuation_token | Token for the next page of top-level comments. |
video_id from a YouTube watch URL, the value after v=.continuation_token from the response as the continuation_token parameter to get the next page.language_code defaults to zh-CN. Set language_code to change this.reply_continuation_token.$0.001 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
Send the selected video_id with an explicit sort_by of top or newest. Set language_code and country_code for your research context and need_format true for the simplified response. Omit continuation_token on the first request. The selected schema has no page-size or numeric offset parameter; the saved example contains 20 comments, which is an observation rather than a guaranteed page size.
Read comments as a list and preserve each comment_id with the video ID. A comment's content can be shortened, while published_time and like/reply counts can be localized display strings. Preserve the raw text and retrieval time; relative time is not an exact timestamp, missing counts are unknown and abbreviated counts are approximate. Author flags describe the response, not independent identity verification.
Top ordering is provider-ranked; it is not a documented descending-like sort or a representative survey of everyone who watched. Newest ordering is a different sample. An empty page does not by itself prove that comments are disabled, deleted or absent everywhere. State the video, chosen sort, locale and collected page count when summarizing what the returned commenters said.
There are two token scopes. The top-level continuation_token continues the top-level comment list. A comment's reply_continuation_token belongs to that comment and is passed as continuation_token to the separate Video Comment Replies endpoint. Do not swap them, guess a token from a comment ID, or reuse a token from another video. A returned nonempty token is not itself a tested continuation roundtrip.
This first task stops after one page. Later pagination must preserve the selected video, sort and locale; reply expansion must preserve the parent comment identity and its own budget. No continuation or reply request was executed for this revision, and no automated moderation, posting or sentiment-model call is part of this read.
Already connected? Provide one video_id and choose metadata or a first comments page. For a new integration, share the setup Skill, Markdown quickstart, selected endpoint and desired output. Keep SANDBASE_API_KEY in your local environment; the API tab uses POST /v1/api/ with Bearer authentication. Save one response before deciding to fetch another page or reply thread.
Validate completed SandBase status and an object at outputs[0].data. These simplified reference payloads put video fields or comments directly there; do not read an undocumented top-level output fallback or silently convert a missing payload into an empty object. A present empty comments list and a malformed response are different outcomes. Keep raw data for local parser checks without retrying the business call automatically.
Pricing checked on 2026-11-08: both endpoints list $0.001 per call and eligibility for 100 daily calls shared across eligible data APIs in the organization, resetting at 00:00 UTC. Eligibility does not measure remaining allowance. Verify current pricing before execution. This revision made no new business call. The YouTube Python comment guide separates historical observations, current references and offline checks.
開発を始める
統一認証と使用状況の追跡を備えたプラットフォームAPIエンドポイントです。
curl -X POST "https://api.sandbase.ai/v1/api/youtube/web-v2/video-comments" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sort_by": "top",
"video_id": "dQw4w9WgXcQ",
"need_format": true,
"country_code": "US",
"language_code": "zh-CN"
}'SandBaseのAPIキーをサーバー環境に設定してください。リクエストはBearer認証を使用します。
export SANDBASE_API_KEY="YOUR_API_KEY"キーはサーバー側で管理してください。ブラウザコードに公開しないでください。
video_idstring必須**Purpose**: Video ID
continuation_tokenstring**Purpose**: Pagination token for next page
country_codestring**Purpose**: Set region code
デフォルト: "US"
language_codestring**Purpose**: Set language preference for comments
デフォルト: "zh-CN"
need_formatboolean**Purpose**: Whether to return cleaned simplified data
デフォルト: true
sort_bystring**Purpose**: Comment sorting method
指定可能な値: top, newest
このAPIの保存済みサンプルレスポンスです。表示時にライブリクエストは行われません。
[
{
"data": {
"comments": [
{
"author": {
"avatar_thumbnails": null,
"avatar_url": "https://yt3.ggpht.com/3s6evpqAiDU9tQR4sC2siJippbH2RWVPnwHgyl4V0th2iuQz0VDQZbUhQBGmsxLYo-mjG6TqZQ=s88-c-k-c0x00ffffff-no-rj",
"channel_id": "UCBR8-60-B28hp2BmDPdntcQ",
"channel_url": "https://www.youtube.com/@YouTube",
"display_name": "@YouTube",
"is_artist": false,
"is_creator": false,
"is_verified": true
},
"comment_id": "Ugzge340dBgB75hWBm54AaABAg",
"content": "can confirm: he never gave us up",
"creator_thumbnail_url": "https://yt3.ggpht.com/_ShEGOdg-t5YGJse14Ooq6FYBZqX_QSlhaTNjG06miYusm5lWm1UroLyVxnYtahADfRTVLtuVQ=s88-c-k-c0x00ffffff-no-rj",
"like_count": "32万",
"like_count_a11y": "32万 次赞",
"published_time": "1年前",
"reply_continuation_token": "Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd6Z2UzNDBkQmdCNzVoV0JtNTRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3pnZTM0MGRCZ0I3NWhXQm01NEFhQUJBZw%3D%3D",
"reply_count": "961",
"reply_count_a11y": "961 条回复",
"reply_count_text": "961 条回复",
"reply_level": 0
},
{
"author": {
"avatar_thumbnails": null,
"avatar_url": "https://yt3.ggpht.com/ytc/AIdro_kDD-FhIbth2qcBbI9VGxR41dJa0kE3kN9iVlGzNgRU_g=s88-c-k-c0x00ffffff-no-rj",
"channel_id": "UCKrzgYonJnMd0Dk7zQXjYXw",
"channel_url": "https://www.youtube.com/@grustache4569",
"display_name": "@grustache4569",
"is_artist": false,
"is_creator": false,
"is_verified": false
},
"comment_id": "UgzKYksqeQ5gA3t0g0F4AaABAg",
"content": "I Rick rolled my entire French class because we had to study a city in France and make a quiz about it as well as a presentation, I decided to make a Kahoot quiz because it’s very easy. I put a link in to this saying it’s the kahoot link. The teacher needless to say got very very mad. As well as my classmates asking who rick rolls in 2019",
"creator_thumbnail_url": null,
"like_count": "10万",
"like_count_a11y": "10万 次赞",
"published_time": "6年前(修改过)",
"reply_continuation_token": "Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd6S1lrc3FlUTVnQTN0MGcwRjRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3pLWWtzcWVRNWdBM3QwZzBGNEFhQUJBZw%3D%3D",
"reply_count": "579",
"reply_count_a11y": "579 条回复",
"reply_count_text": "579 条回复",
"reply_level": 0
},
{
"author": {
"avatar_thumbnails": null,
"avatar_url": "https://yt3.ggpht.com/ytc/AIdro_kcDoQJUNDkDzTrA5kaF5ADVujN-6UcDjMP2Kydtw=s88-c-k-c0x00ffffff-no-rj",
"channel_id": "UCdi6tGxvFvTRGe-7dAn7m7w",
"channel_url": "https://www.youtube.com/@bdr8823",
"display_name": "@bdr8823",
"is_artist": false,
"is_creator": false,
"is_verified": false
},
"comment_id": "UgwPwTibxdgqCHZxktd4AaABAg",
"content": "My algebra teacher said that this was a link to the test answers",
"creator_thumbnail_url": null,
"like_count": "6.8万",
"like_count_a11y": "6.8万 次赞",
"published_time": "7年前",
"reply_continuation_token": "Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd3UHdUaWJ4ZGdxQ0haeGt0ZDRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3dQd1RpYnhkZ3FDSFp4a3RkNEFhQUJBZw%3D%3D",
"reply_count": "609",
"reply_count_a11y": "609 条回复",
"reply_count_text": "609 条回复",
"reply_level": 0
},
"… 17 more items in the full response"
],
"continuation_token": "Eg0SC2RRdzR3OVdnWGNRGAYymQMK3AJnZXRfcmFua2VkX3N0cmVhbXMtLUNxZ0JDSUFFRlJlMzBUZ2FuUUVLbUFFSTJGOFFnQVFZQnlLTkFmdVNwRWFFcU12eXFYV19RcDRxMC1XSVBSVmEtd2dRSkZZSkUzVjNEUEZKSGxSZC1WM1dncEk5dFl2SzVqTkFFU2lWS19IVWdjOGNWOVpFck52cUZXNlNSbDBsc2RqYUhvUG9XamxCNmJNS0lqaTVxRnlNbldnYzlrR0d6aFRsQW43RFVZWWUwMGFvbG1uaW5LWmdIQ0dLUVdGcnpfTDE4Z1ljc2pmdGloVUstWVFsTWVZb0Yyb3NBbXJTQWhBVUVnY0loeUFRQVJnQUVnY0loQ0FRRHhnQkVnY0lpU0FRQVJnQUVnVUlxQ0FZQUJJRkNNQWdHQUFTQlFpSUlCZ0FFZ2NJaFNBUUJCZ0JFZ1VJdXlBWUFCSUZDSVlnR0FCUUFGZ0IiESILZFF3NHc5V2dYY1EwAHgBKBQwAUIhZW5nYWdlbWVudC1wYW5lbC1jb21tZW50cy1zZWN0aW9u"
}
}
]さらに探索
| API | 価格 | レスポンス |
|---|---|---|
YouTube Video Commentsこの API YouTube | $0.001 / 回 | JSON |
YouTube | $0.001 / 回 | JSON |
YouTube | $0.001 / 回 | JSON |
YouTube | $0.001 / 回 | JSON |
YouTube | $0.001 / 回 | JSON |
YouTube | $0.001 / 回 | JSON |
質問
Authorization ヘッダー(Bearer)に SandBase API key を指定し、パラメータを JSON ボディで送信して https://api.sandbase.ai/v1/api/youtube/web-v2/video-comments に POST リクエストを送ります。このページの Playground で、コードを書かずに試すこともできます。
1回あたり $0.001、SandBase 残高から課金されます。課金対象はご利用分のみで、サブスクリプションはありません。
必須: video_id (string)。 任意: continuation_token (string), country_code (string), language_code (string), need_format (boolean) と sort_by(top, newest のいずれか)。 このページの Parameters テーブルと Playground に、すべてのフィールドが一覧表示されています。
同じ HTTP リクエスト内で返される JSON レスポンスです(同期)。 このページの README にサンプルレスポンスがあります。
いいえ。YouTube Video Comments は SandBase 経由で動作するため、SandBase の API key 1つでこのエンドポイントと、カタログ内の他のすべての API とモデルを利用できます。YouTube の API アクセスを別途申請する必要はありません。
video_id を送り、sort_by に top または newest を選び、意図する locale を設定して、need_format を true にしてください。continuation_token は省略します。スキーマには数値の offset や page-size パラメータはありません。保存例の 20 comments は、保証されたページサイズではありません。
いいえ。Response の top-level continuation_token はトップレベルのコメントを継続します。コメントの reply_continuation_token はその返信スレッドを示し、Video Comment Replies に continuation_token として送ります。video と parent の identity は保持してください。この改訂では、いずれの continuation path も実行されていません。
いいえ。空の page だけでコメントが無効化または削除されたとは判断できませんし、上位順は代表的な視聴者調査でも、文書化された降順に近い sort でもありません。video、sort、locale、sample size を報告し、欠損値、ローカライズ値、省略値はそのまま保持してください。