# YouTube 视频详情 API (youtube.video)

- Canonical page: https://everyinfra.com/youtube-api/video
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "youtube", "action": "video", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: single object
- Mode: sync; add "mode": "async" for slow tasks

YouTube 视频详情按具体视频 `url` 读取一条视频的元数据：标题、简介、播放点赞评论数、时长、发布时间、缩略图、话题标签、简介里的链接 `description_links`，以及评论是否关闭、是否会员专享、是否含付费推广；频道名、订阅数和频道总播放量也一起返回。它回答「这条视频的数据和来龙去脉」，适合核实一条被分享的视频、跟踪单条视频的数据增长，或者补全手里一批视频链接的信息。

这里只读单条视频，不接受日期、时长或排序筛选；要列一个频道的视频，用用户内容。`duration` 是时长，`posted_at` 是 UTC 时间；`url` 要填具体视频链接，不是频道链接。`thumbnail_url` 是缩略图链接。

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=youtube&action=video

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | 具体 YouTube 视频 URL，返回该单视频元数据；不接受搜索用的日期、时长或排序筛选。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| author_name | 作者昵称（显示名）。 |
| author_username | 作者用户名（@handle），通常可用于拼 URL。 |
| author_id | 作者在原平台的唯一 ID。 |
| author_url | 作者在原平台的主页链接。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| comment_count | 评论数。null 表示不公开，不等于 0。 |
| view_count | 浏览/播放数。null 表示不公开，不等于 0。 |
| duration | 时长。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| thumbnail_url | 缩略图链接，分辨率低于 image_url。 |
| hashtags | 正文里的话题标签数组，按出现顺序；没有时不出现这个字段。 |
| is_comments_disabled | 是否关闭评论。 |
| is_members_only | 是否会员专享视频。 |
| is_paid_partnership | 是否含付费推广。 |
| author_follower_count | 作者粉丝数。null 表示不公开。 |
| author_video_count | 频道视频总数。 |
| author_view_count | 频道总播放量。 |
| author_created_at | platform-native meaning |
| description_links | 视频简介里的链接：text、url。 |
| search_rank | 在这次搜索结果里的名次，从 1 开始。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "youtube",
  "action": "video",
  "params": {
    "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "youtube",
        "action": "video",
        "params": {
            "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-09-26T08:56:04Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "youtube",
  "action": "video",
  "results": {
    "id": "dQw4w9WgXcQ",
    "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
    "text": "The official video for “Never Gonna Give You Up” by Rick Astley. \n\nNever: The Autobiography 📚 OUT NOW! \nFollow this link to get your copy and listen to Rick’s ‘Never’ playlist ❤️ #RickAstleyNever\nhttps://linktr.ee/rickastleynever\n\n“Never Gonna Give You Up” was a global smash on i…",
    "author_name": "•••",
    "author_username": "•••",
    "author_id": "•••",
    "author_url": "https://www.youtube.com/•••",
    "like_count": 19000000,
    "comment_count": 2457642,
    "view_count": 1820151607,
    "duration": "00:03:33",
    "posted_at": "2009-10-25T06:57:33+00:00",
    "platform": "youtube"
  },
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 怎么跟踪一条视频的播放增长？

按固定间隔用同一个 `url` 读取，把 `view_count`、`like_count`、`comment_count` 连同读取时间存下来，相邻两次相减就是这段时间的增量。`view_count`、`comment_count` 为 null 表示不公开，不等于 0，遇到 null 就记成缺失，不要记成零增长。读取时间用你自己的时钟记录，不要拿 `posted_at` 代替，它只是发布时间。

### `description_links` 有什么用？

它把简介里的链接逐个列出来，每个带文字和地址。分析达人带货或引流时，不用自己从简介里抠链接，直接就能看出这条视频把观众导向了哪些链接。要按域名归类，得自己解析每项的地址。再对照 `is_paid_partnership`，能看出带链接的视频是否含付费推广。批量核对时，把每条视频的 `url` 和它的 `description_links` 存成一张表，同一个落地链接出现在多条视频里，一眼就能看出来。

### 视频详情和用户内容返回的字段一样吗？

字段相同，区别在入口：视频详情传一个视频链接、返回一个对象；用户内容传频道链接、返回一串视频，还可以按发布日期和排序筛选。先用用户内容列出一个频道的视频，再把想细看的那条 `url` 交给视频详情单独读取。用户内容只列常规视频，Shorts 不在其中；同一套解析代码两页都能用。

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=youtube
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
