获取视频评论/Get video comments

YouTubeapi

About

获取视频评论/Get video comments

Documentation

获取视频评论/Get video comments

[中文]

用途:

  • 获取YouTube视频的一级评论

参数详解:

📌 必选参数:

video_id (string)

  • 作用: 视频ID
  • 格式: YouTube视频ID字符串
  • 示例: "oaSNBz4qMQY"
  • 获取方式: 从URL https://www.youtube.com/watch?v=oaSNBz4qMQY 中提取

⚙️ 可选参数:

language_code (string, 可选)

  • 作用: 设置评论显示的语言偏好
  • 默认值: "zh-CN"
  • 可用值: "zh-CN", "en-US", "ja-JP", "ko-KR"

country_code (string, 可选)

  • 作用: 设置地区代码
  • 默认值: "US"
  • 可用值: "US", "JP", "GB"

sort_by (string, 可选)

  • 作用: 评论排序方式
  • 默认值: "top"
  • 可用值:
    • "top" - 热门评论(按点赞数排序)
    • "newest" - 最新评论(按时间排序)

continuation_token (string, 可选)

  • 作用: 翻页令牌,用于获取下一页评论
  • 默认值: null
  • 获取方式: 从上一次请求的响应中提取

need_format (boolean, 可选)

  • 作用: 是否返回清洗后的精简数据
  • 默认值: true
  • 可用值:
    • false - 返回原始完整数据
    • true - 返回清洗后的精简数据(推荐,默认)

返回数据结构 (need_format=true):

{
  "comments": [
    {
      "comment_id": "UgzRDoUJAvDNn5_8i8p4AaABAg",
      "content": "评论内容文本",
      "published_time": "1天前",
      "reply_level": 0,
      "like_count": "2",
      "like_count_a11y": "2 次赞",
      "reply_count": "0",
      "reply_count_a11y": "0 条回复",
      "reply_count_text": "1 条回复",
      "reply_continuation_token": "...",
      "author": {
        "channel_id": "UCzRzHrLFuH0lHZYnrI84I8Q",
        "display_name": "@username",
        "channel_url": "https://www.youtube.com/@username",
        "avatar_url": "https://yt3.ggpht.com/...",
        "avatar_thumbnails": [
          {"url": "...", "width": 88, "height": 88}
        ],
        "is_verified": false,
        "is_creator": false,
        "is_artist": false
      },
      "creator_thumbnail_url": "https://yt3.ggpht.com/..."
    }
  ],
  "continuation_token": "下一页token"
}

字段说明:

  • comment_id: 评论唯一ID
  • content: 评论文本内容
  • published_time: 发布时间(相对时间,如"1天前")
  • reply_level: 回复层级(0表示一级评论)
  • like_count: 点赞数
  • reply_count: 回复数
  • reply_count_text: 回复数文本(如"1 条回复")
  • reply_continuation_token: 获取该评论回复的token
  • author: 评论作者信息
    • channel_id: 作者频道ID
    • display_name: 显示名称
    • channel_url: 频道URL
    • avatar_url: 头像URL
    • is_verified: 是否已认证
    • is_creator: 是否为视频创作者
    • is_artist: 是否为音乐人
  • creator_thumbnail_url: 视频创作者头像URL

[English]

Purpose:

  • Get YouTube video first-level comments

Parameters:

📌 Required:

video_id (string)

  • Purpose: Video ID
  • Format: YouTube video ID string
  • Example: "oaSNBz4qMQY"
  • How to get: Extract from URL https://www.youtube.com/watch?v=oaSNBz4qMQY

⚙️ Optional:

language_code (string, optional)

  • Purpose: Set language preference for comments
  • Default: "zh-CN"
  • Values: "zh-CN", "en-US", "ja-JP", "ko-KR", etc.

country_code (string, optional)

  • Purpose: Set region code
  • Default: "US"
  • Values: "US", "JP", "GB", etc.

sort_by (string, optional)

  • Purpose: Comment sorting method
  • Default: "top"
  • Values:
    • "top" - Top comments (sorted by likes)
    • "newest" - Newest comments (sorted by time)

continuation_token (string, optional)

  • Purpose: Pagination token for next page
  • Default: null
  • How to get: Extract from previous response

need_format (boolean, optional)

  • Purpose: Whether to return cleaned simplified data
  • Default: true
  • Values:
    • false - Return raw complete data
    • true - Return cleaned simplified data (recommended, default)

Response Structure (need_format=true):

{
  "comments": [
    {
      "comment_id": "UgzRDoUJAvDNn5_8i8p4AaABAg",
      "content": "Comment text content",
      "published_time": "1 day ago",
      "reply_level": 0,
      "like_count": "2",
      "like_count_a11y": "2 likes",
      "reply_count": "0",
      "reply_count_a11y": "0 replies",
      "reply_count_text": "1 reply",
      "reply_continuation_token": "...",
      "author": {
        "channel_id": "UCzRzHrLFuH0lHZYnrI84I8Q",
        "display_name": "@username",
        "channel_url": "https://www.youtube.com/@username",
        "avatar_url": "https://yt3.ggpht.com/...",
        "avatar_thumbnails": [
          {"url": "...", "width": 88, "height": 88}
        ],
        "is_verified": false,
        "is_creator": false,
        "is_artist": false
      },
      "creator_thumbnail_url": "https://yt3.ggpht.com/..."
    }
  ],
  "continuation_token": "next page token"
}

Field Descriptions:

  • comment_id: Unique comment ID
  • content: Comment text content
  • published_time: Published time (relative, e.g., "1 day ago")
  • reply_level: Reply level (0 for first-level comments)
  • like_count: Number of likes
  • reply_count: Number of replies
  • reply_count_text: Reply count text (e.g., "1 reply")
  • reply_continuation_token: Token to get replies for this comment
  • author: Comment author info
    • channel_id: Author's channel ID
    • display_name: Display name
    • channel_url: Channel URL
    • avatar_url: Avatar URL
    • is_verified: Whether verified
    • is_creator: Whether video creator
    • is_artist: Whether artist
  • creator_thumbnail_url: Video creator's avatar URL

[示例/Examples]

获取热门评论

GET /youtube_web/get_video_comments?video_id=oaSNBz4qMQY&sort_by=top

获取最新评论

GET /youtube_web/get_video_comments?video_id=oaSNBz4qMQY&sort_by=newest

获取清洗后的评论数据(推荐)

GET /youtube_web/get_video_comments?video_id=oaSNBz4qMQY&need_format=true

翻页获取更多评论

GET /youtube_web/get_video_comments?video_id=oaSNBz4qMQY&continuation_token=xxx&need_format=true

Imported from a validated TikHub OpenAPI document. Pricing must be reviewed before enabling.

Try 获取视频评论/Get video comments

Test this model in the Sandbase Playground with your own prompts.

Open in Playground

Related Models