# YouTube 频道帖子 API (youtube.community_posts)

- Canonical page: [https://everyinfra.com/youtube-api/community_posts](https://everyinfra.com/youtube-api/community_posts?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "youtube", "action": "community_posts", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, one page of 10 per call (limit is ignored; pass the top-level next_page_token from the response as page_token for the next page)
- Pagination: pass next_page_token back as page_token for the next page, other params unchanged; one call per page, tokens last 24 hours
- Mode: sync; add "mode": "async" for slow tasks

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | YouTube 频道链接（youtube.com/@NASA、youtube.com/channel/UC…），也可以只给 @用户名或 UC 开头的频道编号。返回频道「帖子」页里的帖子，新的在前。 |
| page_token | not declared | no | not declared | 翻页令牌。第一页不传；响应有 next_page_token 时原样作 page_token 传回，其他参数不变。一页 10 条，limit 不起作用。每页算一次调用；令牌 24 小时有效。没有 next_page_token 就是翻不下去了。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| author_name | 作者昵称（显示名）。 |
| author_username | 作者用户名（@handle），通常可用于拼 URL。 |
| author_id | 作者在原平台的唯一 ID。 |
| author_url | 作者在原平台的主页链接。 |
| author_avatar_url | 作者头像图片链接（多数平台带签名、会过期）。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| comment_count | 评论数。null 表示不公开，不等于 0。 |
| published_text | YouTube 页面上写的发布时间，是相对说法（如 2 years ago），原样给；页面没写是 null。 |
| attachment_type | 帖子带了什么：image 一张图、multi_image 多张图、video 视频、poll 投票；只有文字是 null。 |
| image_urls | 图片链接数组，按平台展示顺序；没有图片时不出现这个字段。 |
| video_id | 所属视频的编号；帖子评论的回复里是 null。频道帖子里是帖子附带的那条视频的编号，没附视频是 null。 |
| video_title | 帖子附带的那条视频的标题，没附视频是 null。 |
| poll_options | 投票的选项，文字数组；不是投票帖是空数组。 |
| poll_total_votes | 投票的总票数，整数（YouTube 页面给的是约数，如 1.8M 记作 1800000）；不是投票帖是 null。 |
| links | 帖子正文里的链接，数组。 |
| 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": "community_posts",
  "params": {
    "url": "https://www.youtube.com/@MrBeast"
  }
}'
```

```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": "community_posts",
        "params": {
            "url": "https://www.youtube.com/@MrBeast",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-11-21T07:24:23Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed; the list keeps the first 2 of 10. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "youtube",
  "action": "community_posts",
  "results": [
    {
      "id": "UgkxIkDHJ9iW7XmjtMbke3Ud7rEiV5jSHDnR",
      "url": "https://www.youtube.com/post/UgkxIkDHJ9iW7XmjtMbke3Ud7rEiV5jSHDnR",
      "text": "Hunger Games In Real Life drops on Saturday!\nWe designed custom suits that detect when they’re hit by magnetic foam weapons 👀",
      "author_name": "MrBeast",
      "author_username": "MrBeast",
      "author_id": "•••",
      "author_url": "https://www.youtube.com/@MrBeast",
      "author_avatar_url": "https://yt3.googleusercontent.com/•••",
      "like_count": 307000,
      "comment_count": 6200,
      "published_text": "10 days ago",
      "attachment_type": "multi_image",
      "image_urls": [
        "https://yt3.ggpht.com/-nihmRU8RGnrkkYNC73Y_eRRp03ReHeIdKSE8oqRy-HOu0dfZ-7Y5ND61lI9CS3Thlec0shis6WGXQ=s1400-c-fcrop64=1,00001000ffffefff-rw-nd-v1",
        "https://yt3.ggpht.com/g2LFXicy-wjSH-5pvMPnOnp0YHZXO0VaOzf8Y9yws0OFoH2yQjx_1abszLqWNv6f7BoJ3VnXmB6S=s1400-c-fcrop64=1,00001000ffffefff-rw-nd-v1"
      ],
      "platform": "youtube"
    },
    {
      "id": "Ugkx2lkCYp85jak0n5z7-bq_4ug2Rntk9iWT",
      "url": "https://www.youtube.com/post/Ugkx2lkCYp85jak0n5z7-bq_4ug2Rntk9iWT",
      "text": "These last two videos are the best content we’ve ever made and somehow our next 3 uploads are even better. (The team is cooking) I’m feeling more excited and energized about our videos than ever before, new era of Beast coming up 🥰",
      "author_name": "MrBeast",
      "author_username": "MrBeast",
      "author_id": "•••",
      "author_url": "https://www.youtube.com/@MrBeast",
      "author_avatar_url": "https://yt3.googleusercontent.com/•••",
      "like_count": 175000,
      "comment_count": 5000,
      "published_text": "1 month ago",
      "attachment_type": "image",
      "image_urls": [
        "https://yt3.ggpht.com/9davaq2roo2vRpZ80IIGBiCAy6CmeYfm17AkJbLofKYVreyWRk9Y3SF2tcHwTpdGSzRXym9Y_6096A=s988-c-fcrop64=1,00c60000ff39ffff-rw-nd-v1"
      ],
      "platform": "youtube"
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": 10,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## 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
