YouTube
为你的网站和应用添加 YouTube 功能
- 认证方式
- OAuth
- HTTPS
- Yes
- CORS
- Unknown
- 分类
- 视频
简介
YouTube Data API v3 提供视频、频道、播放列表、搜索、评论和分析。读取端点用免费 API 密钥即可;用户级操作(上传、播放列表、点赞)需要 OAuth。是视频应用和内容面板的标准后端。
注(2026-08 实测):无效 API 密钥返回 HTTP 400——你需要从 Google Cloud Console 获取密钥(启用 “YouTube Data API v3”)。
快速开始
视频详情(替换 YOUR_KEY):
curl "https://www.googleapis.com/youtube/v3/videos?part=snippet,statistics&id=dQw4w9WgXcQ&key=YOUR_KEY"
搜索:
curl "https://www.googleapis.com/youtube/v3/search?part=snippet&q=cats&maxResults=5&key=YOUR_KEY"
频道信息:
curl "https://www.googleapis.com/youtube/v3/channels?part=statistics&forUsername=NASA&key=YOUR_KEY"
热门视频:
curl "https://www.googleapis.com/youtube/v3/videos?part=snippet&chart=mostPopular®ionCode=US&key=YOUR_KEY"
认证方式
- API 密钥(免费,Google Cloud Console):读取端点——搜索、视频、频道、评论、播放列表。
- OAuth:用户级操作(上传、点赞/取消点赞、订阅)——列表的 OAuth 标记即指此。
速率限制与注意事项
- 免费配额:10,000 单位/天(一次典型视频详情调用 = 1 单位;搜索 = 100 单位)——请精打细算。
part=必填,选择返回的字段(snippet、statistics、contentDetails……)。regionCode和videoCategoryId筛选热门信息流。- API 由 Google Cloud 提供——密钥是强制的(无效密钥 400)。
常见问题
YouTube API 免费吗? 是的——免费密钥带 10,000 单位/天配额。
需要 OAuth 吗? 只有用户操作需要——读取用简单 API 密钥即可。
如何获取密钥? Google Cloud Console → 启用 YouTube Data API v3 → 创建 API 密钥。
视频 分类更多
| API | Auth | HTTPS | CORS | |
|---|---|---|---|---|
| An API of Ice And Fire Game Of Thrones API | No auth | Yes | Unknown | ↗ |
| Bob's Burgers Bob's Burgers API | No auth | Yes | Yes | ↗ |
| Breaking Bad Breaking Bad API | No auth | Yes | Unknown | ↗ |
| Breaking Bad Quotes Some Breaking Bad quotes | No auth | Yes | Unknown | ↗ |
| Catalogopolis Doctor Who API | No auth | Yes | Unknown | ↗ |