transcriptapi

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

TranscriptAPI

TranscriptAPI

Full YouTube data toolkit via TranscriptAPI.com. Transcripts, search, channels, playlists — one API key.
通过TranscriptAPI.com提供的完整YouTube数据工具包。字幕、搜索、频道、播放列表——一个API密钥即可搞定。

Setup

设置

If
$TRANSCRIPT_API_KEY
is not set, help the user create an account (100 free credits, no card):
Step 1 — Register: Ask user for their email.
bash
node ./scripts/tapi-auth.js register --email USER_EMAIL
→ OTP sent to email. Ask user: "Check your email for a 6-digit verification code."
Step 2 — Verify: Once user provides the OTP:
bash
node ./scripts/tapi-auth.js verify --token TOKEN_FROM_STEP_1 --otp CODE
API key saved to your shell profile and agent config. Ready to use.
Manual option: transcriptapi.com/signup → Dashboard → API Keys.
如果未设置
$TRANSCRIPT_API_KEY
,帮助用户创建账户(100个免费额度,无需信用卡):
步骤1 — 注册: 询问用户的邮箱。
bash
node ./scripts/tapi-auth.js register --email USER_EMAIL
→ 验证码(OTP)将发送至邮箱。询问用户:“请查看您的邮箱获取6位验证码。”
步骤2 — 验证: 用户提供OTP后:
bash
node ./scripts/tapi-auth.js verify --token TOKEN_FROM_STEP_1 --otp CODE
API密钥将保存到您的shell配置和代理配置中。即可开始使用。
手动注册选项:transcriptapi.com/signup → 控制台 → API密钥。

API Reference

API参考

Full OpenAPI spec: transcriptapi.com/openapi.json — consult this for the latest parameters and schemas.
完整OpenAPI规范:transcriptapi.com/openapi.json——请以此为准获取最新参数和数据结构。

Auth

身份验证

All requests:
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
所有请求需携带:
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"

Endpoints

接口端点

Channel endpoints accept
channel
— an
@handle
, channel URL, or
UC...
ID. No need to resolve first. Playlist endpoints accept
playlist
— a playlist URL or ID.
频道类端点接受
channel
参数——可以是@用户名、频道链接或
UC...
格式的ID,无需提前解析。播放列表类端点接受
playlist
参数——可以是播放列表链接或ID。

GET /api/v2/youtube/transcript — 1 credit

GET /api/v2/youtube/transcript — 1个额度

bash
curl -s "https://transcriptapi.com/api/v2/youtube/transcript\
?video_url=VIDEO_URL&format=text&include_timestamp=true&send_metadata=true" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
ParamRequiredDefaultValidation
video_url
yesYouTube URL or 11-char video ID
format
no
json
json
or
text
include_timestamp
no
true
true
or
false
send_metadata
no
false
true
or
false
Accepts:
https://youtube.com/watch?v=ID
,
https://youtu.be/ID
,
youtube.com/shorts/ID
, or bare
ID
.
Response (
format=json
):
json
{
  "video_id": "dQw4w9WgXcQ",
  "language": "en",
  "transcript": [
    { "text": "We're no strangers...", "start": 18.0, "duration": 3.5 }
  ],
  "metadata": { "title": "...", "author_name": "...", "author_url": "..." }
}
bash
curl -s "https://transcriptapi.com/api/v2/youtube/transcript\
?video_url=VIDEO_URL&format=text&include_timestamp=true&send_metadata=true" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数是否必填默认值验证规则
video_url
YouTube链接或11位视频ID
format
json
json
text
include_timestamp
true
true
false
send_metadata
false
true
false
支持的输入格式:
https://youtube.com/watch?v=ID
https://youtu.be/ID
youtube.com/shorts/ID
或纯ID。
响应
format=json
):
json
{
  "video_id": "dQw4w9WgXcQ",
  "language": "en",
  "transcript": [
    { "text": "We're no strangers...", "start": 18.0, "duration": 3.5 }
  ],
  "metadata": { "title": "...", "author_name": "...", "author_url": "..." }
}

GET /api/v2/youtube/search — 1 credit

GET /api/v2/youtube/search — 1个额度

bash
curl -s "https://transcriptapi.com/api/v2/youtube/search?q=QUERY&type=video&limit=20" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
ParamRequiredDefaultValidation
q
yes1-200 chars (trimmed)
type
no
video
video
or
channel
limit
no
20
1-50
Response (
type=video
):
json
{
  "results": [
    {
      "type": "video",
      "videoId": "dQw4w9WgXcQ",
      "title": "Rick Astley - Never Gonna Give You Up",
      "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
      "channelTitle": "Rick Astley",
      "channelHandle": "@RickAstley",
      "channelVerified": true,
      "lengthText": "3:33",
      "viewCountText": "1.5B views",
      "publishedTimeText": "14 years ago",
      "hasCaptions": true,
      "thumbnails": [{ "url": "...", "width": 120, "height": 90 }]
    }
  ],
  "result_count": 20
}
Response (
type=channel
):
json
{
  "results": [
    {
      "type": "channel",
      "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
      "title": "Rick Astley",
      "handle": "@RickAstley",
      "subscriberCount": "4.2M subscribers",
      "verified": true,
      "rssUrl": "https://www.youtube.com/feeds/videos.xml?channel_id=UC..."
    }
  ],
  "result_count": 5
}
bash
curl -s "https://transcriptapi.com/api/v2/youtube/search?q=QUERY&type=video&limit=20" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数是否必填默认值验证规则
q
1-200字符(自动去首尾空格)
type
video
video
channel
limit
20
1-50
响应
type=video
):
json
{
  "results": [
    {
      "type": "video",
      "videoId": "dQw4w9WgXcQ",
      "title": "Rick Astley - Never Gonna Give You Up",
      "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
      "channelTitle": "Rick Astley",
      "channelHandle": "@RickAstley",
      "channelVerified": true,
      "lengthText": "3:33",
      "viewCountText": "1.5B views",
      "publishedTimeText": "14 years ago",
      "hasCaptions": true,
      "thumbnails": [{ "url": "...", "width": 120, "height": 90 }]
    }
  ],
  "result_count": 20
}
响应
type=channel
):
json
{
  "results": [
    {
      "type": "channel",
      "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
      "title": "Rick Astley",
      "handle": "@RickAstley",
      "subscriberCount": "4.2M subscribers",
      "verified": true,
      "rssUrl": "https://www.youtube.com/feeds/videos.xml?channel_id=UC..."
    }
  ],
  "result_count": 5
}

GET /api/v2/youtube/channel/resolve — FREE (0 credits)

GET /api/v2/youtube/channel/resolve — 免费(0额度)

bash
curl -s "https://transcriptapi.com/api/v2/youtube/channel/resolve?input=@TED" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
ParamRequiredValidation
input
yes1-200 chars — @handle, URL, or UC... ID
Response:
json
{ "channel_id": "UCsT0YIqwnpJCM-mx7-gSA4Q", "resolved_from": "@TED" }
If input is already a valid
UC[a-zA-Z0-9_-]{22}
ID, returns immediately without lookup.
bash
curl -s "https://transcriptapi.com/api/v2/youtube/channel/resolve?input=@TED" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数是否必填验证规则
input
1-200字符——@用户名、链接或UC...格式ID
响应:
json
{ "channel_id": "UCsT0YIqwnpJCM-mx7-gSA4Q", "resolved_from": "@TED" }
如果输入已经是有效的
UC[a-zA-Z0-9_-]{22}
格式ID,将直接返回结果,无需查询。

GET /api/v2/youtube/channel/videos — 1 credit/page

GET /api/v2/youtube/channel/videos — 1个额度/页

bash
undefined
bash
undefined

First page (100 videos)

第一页(100个视频)

curl -s "https://transcriptapi.com/api/v2/youtube/channel/videos?channel=@NASA"
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
curl -s "https://transcriptapi.com/api/v2/youtube/channel/videos?channel=@NASA"
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"

Next pages

后续页面

curl -s "https://transcriptapi.com/api/v2/youtube/channel/videos?continuation=TOKEN"
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"

| Param          | Required    | Validation                                    |
| -------------- | ----------- | --------------------------------------------- |
| `channel`      | conditional | `@handle`, channel URL, or `UC...` ID         |
| `continuation` | conditional | non-empty string (next pages)                 |

Provide exactly one of `channel` or `continuation`.

**Response:**

```json
{
  "results": [{
    "videoId": "abc123xyz00",
    "title": "Latest Video",
    "channelId": "UCsT0YIqwnpJCM-mx7-gSA4Q",
    "channelTitle": "TED",
    "channelHandle": "@TED",
    "lengthText": "15:22",
    "viewCountText": "3.2M views",
    "thumbnails": [...],
    "index": "0"
  }],
  "playlist_info": {"title": "Uploads from TED", "numVideos": "5000"},
  "continuation_token": "4qmFsgKlARIYVVV1...",
  "has_more": true
}
curl -s "https://transcriptapi.com/api/v2/youtube/channel/videos?continuation=TOKEN"
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"

| 参数          | 是否必填    | 验证规则                                    |
| -------------- | ----------- | --------------------------------------------- |
| `channel`      | 可选(二选一) | `@用户名`、频道链接或UC...格式ID         |
| `continuation` | 可选(二选一) | 非空字符串(用于获取后续页面)                 |

必须提供`channel`或`continuation`其中一个参数。

**响应:**

```json
{
  "results": [{
    "videoId": "abc123xyz00",
    "title": "Latest Video",
    "channelId": "UCsT0YIqwnpJCM-mx7-gSA4Q",
    "channelTitle": "TED",
    "channelHandle": "@TED",
    "lengthText": "15:22",
    "viewCountText": "3.2M views",
    "thumbnails": [...],
    "index": "0"
  }],
  "playlist_info": {"title": "Uploads from TED", "numVideos": "5000"},
  "continuation_token": "4qmFsgKlARIYVVV1...",
  "has_more": true
}

GET /api/v2/youtube/channel/latest — FREE (0 credits)

GET /api/v2/youtube/channel/latest — 免费(0额度)

bash
curl -s "https://transcriptapi.com/api/v2/youtube/channel/latest?channel=@TED" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
ParamRequiredValidation
channel
yes
@handle
, channel URL, or
UC...
ID
Returns last 15 videos via RSS with exact view counts and ISO timestamps.
Response:
json
{
  "channel": {
    "channelId": "...",
    "title": "TED",
    "author": "TED",
    "url": "..."
  },
  "results": [
    {
      "videoId": "abc123xyz00",
      "title": "Latest Video",
      "published": "2026-01-30T16:00:00Z",
      "viewCount": "2287630",
      "description": "Full description...",
      "thumbnail": { "url": "...", "width": "480", "height": "360" }
    }
  ],
  "result_count": 15
}
bash
curl -s "https://transcriptapi.com/api/v2/youtube/channel/latest?channel=@TED" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数是否必填验证规则
channel
@用户名
、频道链接或UC...格式ID
通过RSS返回最新15个视频,包含精确播放量和ISO时间戳。
响应:
json
{
  "channel": {
    "channelId": "...",
    "title": "TED",
    "author": "TED",
    "url": "..."
  },
  "results": [
    {
      "videoId": "abc123xyz00",
      "title": "Latest Video",
      "published": "2026-01-30T16:00:00Z",
      "viewCount": "2287630",
      "description": "Full description...",
      "thumbnail": { "url": "...", "width": "480", "height": "360" }
    }
  ],
  "result_count": 15
}

GET /api/v2/youtube/channel/search — 1 credit

GET /api/v2/youtube/channel/search — 1个额度

bash
curl -s "https://transcriptapi.com/api/v2/youtube/channel/search\
?channel=@TED&q=climate+change&limit=30" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
ParamRequiredValidation
channel
yes
@handle
, channel URL, or
UC...
ID
q
yes1-200 chars
limit
no1-50 (default 30)
bash
curl -s "https://transcriptapi.com/api/v2/youtube/channel/search\
?channel=@TED&q=climate+change&limit=30" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数是否必填验证规则
channel
@用户名
、频道链接或UC...格式ID
q
1-200字符
limit
1-50(默认30)

GET /api/v2/youtube/playlist/videos — 1 credit/page

GET /api/v2/youtube/playlist/videos — 1个额度/页

bash
undefined
bash
undefined

First page

第一页

curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?playlist=PL_PLAYLIST_ID"
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?playlist=PL_PLAYLIST_ID"
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"

Next pages

后续页面

curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?continuation=TOKEN"
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"

| Param          | Required    | Validation                                           |
| -------------- | ----------- | ---------------------------------------------------- |
| `playlist`     | conditional | Playlist URL or ID (`PL`/`UU`/`LL`/`FL`/`OL` prefix) |
| `continuation` | conditional | non-empty string                                     |
curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?continuation=TOKEN"
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"

| 参数          | 是否必填    | 验证规则                                           |
| -------------- | ----------- | ---------------------------------------------------- |
| `playlist`     | 可选(二选一) | 播放列表链接或ID(前缀为`PL`/`UU`/`LL`/`FL`/`OL`) |
| `continuation` | 可选(二选一) | 非空字符串                                     |

Credit Costs

额度消耗

EndpointCost
transcript1
search1
channel/resolvefree
channel/search1
channel/videos1/page
channel/latestfree
playlist/videos1/page
端点消耗额度
transcript1
search1
channel/resolve免费
channel/search1
channel/videos1/页
channel/latest免费
playlist/videos1/页

Errors

错误码说明

CodeMeaningAction
401Bad API keyCheck key, re-run setup
402No creditsTop up at transcriptapi.com/billing
404Not foundVideo/channel/playlist doesn't exist or no captions
408Timeout/retryableRetry once after 2s
422Validation errorCheck param format
429Rate limitedWait, respect Retry-After
状态码含义处理方式
401API密钥无效检查密钥,重新执行设置流程
402额度不足前往transcriptapi.com/billing充值
404资源不存在视频/频道/播放列表不存在或无字幕
408请求超时(可重试)等待2秒后重试一次
422参数验证失败检查参数格式
429请求频率超限等待,遵循Retry-After响应头指示

Tips

使用技巧

  • When user shares YouTube URL with no instruction, fetch transcript and summarize key points.
  • Use
    channel/latest
    (free) to check for new uploads before fetching transcripts — pass @handle directly.
  • For research: search → pick videos → fetch transcripts.
  • Free tier: 100 credits, 300 req/min. Starter ($5/mo): 1,000 credits, 300 req/min.
  • 当用户仅分享YouTube链接未说明需求时,自动获取字幕并总结要点。
  • 使用免费的
    channel/latest
    接口检查新上传视频后再获取字幕——可直接传入@用户名。
  • 研究场景流程:搜索→选择视频→获取字幕。
  • 免费版:100个额度,每分钟300次请求。基础版(5美元/月):1000个额度,每分钟300次请求。