Files
nexus/wiki/concepts/YouTube-Data-API-v3.md
2026-04-28 16:03:03 +08:00

41 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "YouTube Data API v3"
type: concept
tags: [youtube, google-cloud, api, data]
last_updated: 2026-04-23
---
## Overview
YouTube Data API v3 是 Google 官方提供的 YouTube 编程接口,允许开发者通过 API Key 访问 YouTube 频道、视频、播放列表等数据,是解决 YouTube 爬虫限制的最稳定方案。
## Key Capabilities
- 获取频道信息(标题、描述、缩略图)
- 获取频道最新视频列表
- 获取播放列表内容
- **免费额度**: 每月 10,000 单位(足够个人用户正常使用)
## How to Get API Key
1. 访问 [Google Cloud Console](https://console.cloud.google.com/)
2. 创建新项目,命名如 `My-RSSHub`
3. 启用 **YouTube Data API v3**
4. 在「凭据」页面创建 API 密钥
5. (推荐)为密钥设置 API 限制,仅允许 YouTube Data API v3
## Usage in This Wiki
- RSSHub 通过 `YOUTUBE_KEY` 环境变量使用此 API 稳定获取 YouTube 频道更新
- 配合本地 HTTP 代理(`HTTP_PROXY`)可在容器内绕过网络限制
## Security Best Practice
- 为 API Key 设置 HTTP 来源限制Referrer Restrictions
- 仅在 YouTube Data API v3 中启用该密钥,防止 Key 泄露后被滥用
## Connections
- [[RSSHub]] ← requires ← [[YouTube Data API v3]]
- [[YouTube Content Pipeline]] ← uses ← [[YouTube Data API v3]]
## Aliases
- YouTube API
- YouTube Data API
- YouTube Data API v3
- YOUTUBE_KEY