YouTube-Web-V2-API

获取视频详情 /Get video information

Changed on

[中文]

用途:

  • 获取YouTube视频详情信息
  • 返回原始完整数据(包含 playerResponse 和 initialData)

下载与代理:

  • 调用本详情接口无需自带代理;本接口不接受 proxy_url。 streamingData 中即使出现媒体 URL,也不保证可从不同公网出口下载。
  • 如需下载,推荐 get_video_streams_v3:使用固定出口或粘性会话的美国住宅代理, 或固定公网出口的静态住宅/ISP 代理;数据中心代理不作为首选。 美国不是强制地区,地区受限视频应选择允许访问的国家/地区,下载时沿用同一出口。

参数详解:

📌 必选参数:

video_id (string)

  • 作用: 视频ID
  • 获取方式: 从视频URL中提取,例如 https://www.youtube.com/watch?v=oaSNBz4qMQY,video_id 就是 oaSNBz4qMQY
  • 示例: "oaSNBz4qMQY"

⚙️ 可选参数:

language_code (string, 可选)

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

返回数据结构:

{
  "playerResponse": {
    "videoDetails": {},
    "streamingData": {
      "formats": [],
      "adaptiveFormats": []
    },
    "microformat": {},
    ...
  },
  "initialData": {
    "contents": {
      "twoColumnWatchNextResults": {
        "results": {
          "results": {
            "contents": [
              {
                "videoPrimaryInfoRenderer": {...},
                "videoSecondaryInfoRenderer": {...}
              }
            ]
          }
        }
      }
    },
    ...
  }
}

主要字段说明:

  • playerResponse: YouTube 播放器响应数据
    • videoDetails: 视频基本信息(可能为空,取决于YouTube的返回)
    • streamingData: 视频流数据(包含 formats 和 adaptiveFormats,包含 googlevideo.com 的URL)
    • microformat: 元数据信息
  • initialData: YouTube 页面初始化数据
    • videoPrimaryInfoRenderer: 主要信息(标题、观看次数、点赞数等)
    • videoSecondaryInfoRenderer: 次要信息(频道信息、描述等)

[English]

Purpose:

  • Get YouTube video details
  • Returns raw complete data (includes playerResponse and initialData)

Download and proxy:

  • No proxy is required from you to call this detail endpoint. It does not accept proxy_url. A media URL in streamingData, if present, is not guaranteed to download from a different public exit.
  • For downloads, prefer get_video_streams_v3 with a US residential proxy offering a fixed exit or sticky session, or a static residential/ISP proxy with a fixed public exit. Datacenter proxies are not the first choice. The US is not mandatory: use a region where the video is available and keep the same exit for downloading.

Parameters:

📌 Required:

video_id (string)

  • Purpose: Video ID
  • How to get: Extract from video URL, e.g., https://www.youtube.com/watch?v=oaSNBz4qMQY, video_id is oaSNBz4qMQY
  • Example: "oaSNBz4qMQY"

⚙️ Optional:

language_code (string, optional)

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

Response Structure:

{
  "playerResponse": {
    "videoDetails": {},
    "streamingData": {
      "formats": [],
      "adaptiveFormats": []
    },
    "microformat": {},
    ...
  },
  "initialData": {
    "contents": {
      "twoColumnWatchNextResults": {
        "results": {
          "results": {
            "contents": [
              {
                "videoPrimaryInfoRenderer": {...},
                "videoSecondaryInfoRenderer": {...}
              }
            ]
          }
        }
      }
    },
    ...
  }
}

Key Fields:

  • playerResponse: YouTube player response data
    • videoDetails: Basic video info (may be empty depending on YouTube's response)
    • streamingData: Video stream data (includes formats and adaptiveFormats with googlevideo.com URLs)
    • microformat: Metadata information
  • initialData: YouTube page initialization data
    • videoPrimaryInfoRenderer: Primary info (title, view count, like count, etc.)
    • videoSecondaryInfoRenderer: Secondary info (channel info, description, etc.)

[示例/Examples]

获取视频详情数据 / Get video details

GET /youtube_web/get_video_info?video_id=oaSNBz4qMQY

指定语言 / Specify language

GET /youtube_web/get_video_info?video_id=oaSNBz4qMQY&language_code=en-US

get/api/v1/youtube/web_v2/get_video_info

Request

  • Base URL
    https://api.tikhub.io (the document declares no server; this is the origin it was published from)
  • Auth
    HTTP bearer

Query parameters

video_idstring required

视频ID/Video ID

language_codestring

语言代码(如zh-CN, en-US等)/Language code

need_formatboolean

是否需要清洗数据,提取关键内容,移除冗余数据/Whether to clean and format the data

Response

Successful Response

codeinteger

HTTP status code | HTTP状态码

request_idstring nullable

Unique request identifier | 唯一请求标识符

messagestring

Response message (EN-US) | 响应消息 (English)

message_zhstring

Response message (ZH-CN) | 响应消息 (中文)

supportstring

Support message | 支持消息

timestring

The time the response was generated | 生成响应的时间

time_stampinteger

The timestamp the response was generated | 生成响应的时间戳

time_zonestring

The timezone of the response time | 响应时间的时区

docsstring nullable

Link to the API Swagger documentation for this endpoint | 此端点的 API Swagger 文档链接

cache_messagestring nullable

Cache message (EN-US) | 缓存消息 (English)

cache_message_zhstring nullable

Cache message (ZH-CN) | 缓存消息 (中文)

cache_urlstring nullable

The URL to access the cached result | 访问缓存结果的 URL

routerstring

The endpoint that generated this response | 生成此响应的端点

paramsunknown
dataunknown

Changes

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      the response's property default value changed from This request will be cached. You can access the cached result directly using the URL below valid for 24 hours. Accessing the cache will not incur additional charges. to This response is cached and accessible via the URL below for 24 hours at no extra cost. The cache is for request tracing only — it doesn't affect the API's data freshness and won't be returned through the API again. for the status

    • info

      the response's property default value changed from 本次请求将被缓存,你可以使用下面的 URL 直接访问缓存结果,有效期为 24 小时,访问缓存不会产生额外费用。 to 本次响应已缓存,可通过下方 URL 直接查看,有效期 24 小时,访问缓存链接无额外费用。缓存仅用于请求溯源,不影响接口数据的时效性,也不会再次通过接口返回。 for the status