YouTube API
YouTube 影片資訊、頻道資訊、搜尋、留言與字幕。
- 頻道端點同時支援頻道 ID 和 @handle
- 字幕透過
language參數支援多種語言 - 同時回傳手動和自動產生的字幕
- 留言使用
nextPageToken(接續 token)進行分頁
影片
GET /youtube/videos/:videoId — 4 點數
依 ID 取得 YouTube 影片詳細資訊。
| 參數 | 類型 | 必填 | 預設 | 說明 |
|---|---|---|---|---|
videoId | string | 是 | — | YouTube 影片 ID |
cURL
curl -H "x-api-key: sk_byc_xxx" \
https://api.bycrawl.com/youtube/videos/dQw4w9WgXcQ回應
{
"id": "dQw4w9WgXcQ",
"title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
"description": "The official video for \"Never Gonna Give You Up\" by Rick Astley...",
"channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
"channelTitle": "Rick Astley",
"viewCount": 1748801094,
"likeCount": 18832650,
"commentCount": 2400000,
"duration": "3:33",
"publishedAt": "2009-10-25",
"thumbnail": "https://...",
"keywords": ["rick astley", "Never Gonna Give You Up", "nggyu", "rick rolled"]
}GET /youtube/videos/:videoId/comments — 3 點數
取得 YouTube 影片留言。
| 參數 | 類型 | 必填 | 預設 | 說明 |
|---|---|---|---|---|
videoId | string | 是 | — | YouTube 影片 ID |
count | integer | 否 | 20 | 留言數量(最多 50) |
cURL
curl -H "x-api-key: sk_byc_xxx" \
"https://api.bycrawl.com/youtube/videos/dQw4w9WgXcQ/comments?count=10"回應
{
"comments": [
{
"id": "Ugzge340dBgB75hWBm54AaABAg",
"text": "can confirm: he never gave us up",
"author": "@YouTube",
"authorChannelId": "UCBR8-60-B28hp2BmDPdntcQ",
"authorAvatar": "https://...",
"isVerified": false,
"likeCount": 193000,
"replyCount": 0,
"publishedAt": "10 months ago"
}
// ... 更多留言
],
"nextPageToken": null
}GET /youtube/videos/:videoId/transcription — 4 點數
取得影片字幕。回傳帶有時間戳的段落和完整文字。支援手動和自動產生的字幕。
| 參數 | 類型 | 必填 | 預設 | 說明 |
|---|---|---|---|---|
videoId | string | 是 | — | YouTube 影片 ID |
language | string | 否 | en | 語言代碼(例如 en、zh-Hant、ja) |
cURL
curl -H "x-api-key: sk_byc_xxx" \
"https://api.bycrawl.com/youtube/videos/dQw4w9WgXcQ/transcription?language=en"回應
{
"videoId": "dQw4w9WgXcQ",
"title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
"language": "en",
"isAutoGenerated": false,
"availableLanguages": {
"manual": ["de-DE", "en", "es-419", "ja", "pt-BR"],
"automatic": ["af", "ar", "zh-Hans", "zh-Hant", "fr", "de", "ja", "ko", "es"]
},
"segments": [
{ "start": 18.64, "duration": 3.24, "text": "We're no strangers to love" },
{ "start": 22.64, "duration": 4.32, "text": "You know the rules and so do I" }
// ... 更多段落
],
"fullText": "We're no strangers to love You know the rules and so do I..."
}頻道
GET /youtube/channels/:channelId — 2 點數
依頻道 ID 或 @handle 取得 YouTube 頻道資訊。
| 參數 | 類型 | 必填 | 預設 | 說明 |
|---|---|---|---|---|
channelId | string | 是 | — | 頻道 ID 或 @帳號(例如 @MrBeast) |
cURL
curl -H "x-api-key: sk_byc_xxx" \
https://api.bycrawl.com/youtube/channels/@MrBeast回應
{
"id": "UCX6OQ3DkcsbYNE6H8uQQuVA",
"title": "MrBeast",
"description": "SUBSCRIBE FOR A COOKIE!\nNew MrBeast or MrBeast Gaming video every...",
"subscriberCount": 470000000,
"videoCount": 0,
"viewCount": 0,
"thumbnail": "https://...",
"banner": "https://...",
"createdAt": null,
"country": ""
}搜尋
GET /youtube/videos/search — 2 點數
依關鍵字搜尋 YouTube 影片。
| 參數 | 類型 | 必填 | 預設 | 說明 |
|---|---|---|---|---|
q | string | 是 | — | 搜尋關鍵字 |
count | integer | 否 | 10 | 結果數量(最多 20) |
cURL
curl -H "x-api-key: sk_byc_xxx" \
"https://api.bycrawl.com/youtube/videos/search?q=cooking&count=5"回應
{
"videos": [
{
"id": "WP8EMyoWUlM",
"title": "I Cooked For A Lion",
"description": "",
"channelId": "UCMyOj6fhvKFMjxUCp3b_3gA",
"channelTitle": "Nick DiGiovanni",
"viewCount": 43460930,
"likeCount": 0,
"commentCount": 0,
"duration": "24:04",
"publishedAt": "",
"thumbnail": "https://...",
"keywords": []
}
// ... 更多影片
],
"nextPageToken": null
}