# YouTube 的 @handle 怎么转成频道 ID

用 Data API 的 `channels.list`，参数 `forHandle=@名字`（@ 可写可不写）：返回的频道 `id` 以 `UC` 开头，一次耗 1 个配额，不能和 `id`、`forUsername` 等其他筛选条件放在同一个请求里。旧的 `forUsername` 只认老式用户名，所以 Stack Overflow 上很多老答案拿 handle 去查会失败。用 XTikAPI 的话，`youtube.accounts.search` 按关键词找频道，`youtube.accounts.detail` 按 `channel_id` 读频道，一次 $0.002。

更新于 2026-11-21

## 用哪种查法

| 你手上有 | 官方调用 | 说明 |
| --- | --- | --- |
| `@GoogleDevelopers` | `channels.list?part=id,snippet&forHandle=@GoogleDevelopers` | 1 个配额 |
| 老式用户名 | `channels.list?forUsername=...` | 只有 handle 的频道查不到 |
| 一个视频 ID | `videos.list`，读 `snippet.channelId` | 1 个配额 |
| `/channel/UC...` 形式的链接 | 不用查 | 链接里就是 ID |

同时写两个筛选条件会返回 `400 invalidCriteria`。

## XTikAPI 能拿到什么

1. `youtube.accounts.search` 传 `keyword`（handle 或频道名），返回匹配的频道和它们的 ID。
2. `youtube.accounts.detail` 传 `channel_id`，返回频道名、简介和各项数字。
3. `youtube.videos.list` 用同一个 `channel_id` 列出它上传的视频。

要多少钱：查出并读取 500 个频道 = 1000 次 × $0.002 = $2。

## 为什么用 XTikAPI

- XTikAPI 有 12 个YouTube接口，一次 $0.002 起，失败不收费。
- 更省 Token：按 2026-11-18 实测的 11 个YouTube接口真实返回，平台原始 JSON 约 52k token，经 XTikAPI 归一化后约 12k token（省 77.4%），MCP 输出约 13k token（省 75.8%）。
- 先看再用：229 个接口里有 192 个在接口页上放了一份录制的真实返回（YouTube 11/12），字段一目了然。
- 一种返回格式：19 个平台的内容、评论、账号都是同一种对象，作者在 author，互动数在 metrics，换平台不用重写解析。
- 免费试用：验证过邮箱送 $0.50，不用绑卡。

## 用到的接口

- [YouTube 频道搜索](https://xtikapi.com/zh/apis/youtube/accounts/search) ($0.002 / 次): 按关键词搜频道，返回频道和频道编号。
- [YouTube 频道资料](https://xtikapi.com/zh/apis/youtube/accounts/detail) ($0.002 / 次): 按频道编号取频道名、头像、简介和订阅数。
- [YouTube 频道视频](https://xtikapi.com/zh/apis/youtube/videos/list) ($0.002 / 次): 取一个频道上传的视频。

## YouTube的更多问题

- [YouTube API](https://xtikapi.com/zh/apis/youtube)
- [yt-dlp 抓 YouTube 报“not a bot”或评论 Incomplete data 中断怎么办](https://xtikapi.com/zh/answers/yt-dlp-sign-in-to-confirm-not-a-bot)
- [YouTube API 怎么只取一个频道的 Shorts](https://xtikapi.com/zh/answers/youtube-api-list-channel-shorts)
- [YouTube Data API 每天 10000 配额不够用怎么办](https://xtikapi.com/zh/answers/youtube-api-quota-alternative)
- [YouTube commentThreads.list 报 403 commentsDisabled 是什么意思](https://xtikapi.com/zh/answers/youtube-api-comments-disabled-403)

## 出处

本页写到的别家的情况，都来自对方自己的页面和文档，读取于 2026-11-21。

- [YouTube Data API 官方文档：Channels: list（forHandle 参数）](https://developers.google.com/youtube/v3/docs/channels/list)
- [Stack Overflow：YouTube handle 怎么对应到频道 ID](https://stackoverflow.com/questions/74323173)
- [Stack Overflow：怎么从频道名或链接拿到频道 ID](https://stackoverflow.com/questions/13572657)

## 常见问题

### handle 和以前的自定义网址是一回事吗？

不是。handle 以 @ 开头，用 `forHandle` 查；老式用户名用 `forUsername`。一个频道可能两个都有、只有一个，或者都没有。

---

XTikAPI: one API key for public social media data, prepaid per call. [HTML version](https://xtikapi.com/zh/answers/youtube-handle-to-channel-id) · [llms.txt](https://xtikapi.com/llms.txt) · [OpenAPI](https://xtikapi.com/openapi.json)
