youtube-api

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

YouTube API

YouTube API

YouTube data on demand: video/channel/playlist search with real filters (upload date, duration, sort order), channel and video lookups, videos, shorts, live streams, playlist contents, comments, hashtag feeds, and trending — one plain HTTP GET per call, paid as you go. No developer console project, no OAuth consent screen, no daily quota.
Base URL:
https://youtube.fetcher.sh
按需获取 YouTube 数据:支持带真实筛选条件(上传日期、时长、排序方式)的视频/频道/播放列表搜索,频道与视频查询,视频、短视频(Shorts)、直播流、播放列表内容、评论、话题标签信息流以及热门内容查询——每次调用仅需一个简单的 HTTP GET 请求,按使用付费。无需创建开发者控制台项目,无需 OAuth 授权界面,也没有每日配额限制。
Base URL:
https://youtube.fetcher.sh

Authentication

认证方式

Two ways to pay, same data — full mechanics in the
fetcher
skill
:
bash
undefined
两种付费方式,获取的数据完全一致——详细机制请查看
fetcher
技能
bash
undefined

1. Prepaid credits (recommended — get a key at https://fetcher.sh/topup

1. Prepaid credits (recommended — get a key at https://fetcher.sh/topup

or via POST /api/credits/topup, see the fetcher skill)

or via POST /api/credits/topup, see the fetcher skill)

export FETCHER_API_KEY="bby_live_xxxxxxxxxxxx" curl -H "Authorization: Bearer $FETCHER_API_KEY"
"https://youtube.fetcher.sh/api/search/video?query=hello"
export FETCHER_API_KEY="bby_live_xxxxxxxxxxxx" curl -H "Authorization: Bearer $FETCHER_API_KEY"
"https://youtube.fetcher.sh/api/search/video?query=hello"

2. x402 pay-per-call — omit the header; a GET with no payment returns 402

2. x402 pay-per-call — omit the header; a GET with no payment returns 402

with machine-readable payment requirements (USDC on Base, Polygon,

with machine-readable payment requirements (USDC on Base, Polygon,

Arbitrum, Monad, or Solana). @x402/fetch signs and retries automatically.

Arbitrum, Monad, or Solana). @x402/fetch signs and retries automatically.


Every response is `{ "status": number, "message": string, "data": ... }`; the
HTTP status mirrors `status`.

所有响应格式均为 `{ "status": number, "message": string, "data": ... }`;HTTP 状态码与 `status` 字段值一致。

Endpoints (15 — all GET, $0.005/call)

接口(共15个——均为GET请求,每次调用0.005美元)

EndpointWhat it returns
/api/search/video
Videos matching a query; upload date, duration, sort filters
/api/search/channel
Channels matching a query
/api/search/playlist
Playlists matching a query
/api/channel/{id}
Channel details by ID
/api/channel/handle/{handle}
Channel details by @handle
/api/channel/path
Channel details by custom URL path
/api/channel/{id}/videos
A channel's videos
/api/channel/{id}/shorts
A channel's shorts
/api/channel/{id}/live-streams
A channel's live streams
/api/video/{id}
Video (or short) details
/api/video/{id}/comments
A video's comments
/api/shorts/{id}
Short details
/api/playlist/{id}/videos
A playlist's videos
/api/hashtag/{tag}
Videos under a hashtag
/api/trending
Trending videos, optionally by region
{id}
/
{handle}
/
{tag}
are path parameters. Optional
cursor
/
lang
/
geo
refine results;
query
(search) and
channelPath
(path lookup) are required where they appear.
Endpoint返回内容
/api/search/video
匹配查询条件的视频;支持上传日期、时长、排序筛选
/api/search/channel
匹配查询条件的频道
/api/search/playlist
匹配查询条件的播放列表
/api/channel/{id}
通过ID获取频道详情
/api/channel/handle/{handle}
通过@handle获取频道详情
/api/channel/path
通过自定义URL路径获取频道详情
/api/channel/{id}/videos
频道发布的视频
/api/channel/{id}/shorts
频道发布的短视频
/api/channel/{id}/live-streams
频道的直播流
/api/video/{id}
视频(或短视频)详情
/api/video/{id}/comments
视频的评论
/api/shorts/{id}
短视频详情
/api/playlist/{id}/videos
播放列表中的视频
/api/hashtag/{tag}
话题标签下的视频
/api/trending
热门视频,可按地区筛选
{id}
/
{handle}
/
{tag}
为路径参数。可选参数
cursor
lang
geo
可优化结果;
query
(搜索时)和
channelPath
(路径查询时)为必填参数。

Scenarios

使用场景

Uploaded this week:
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "query=ai agents" -G \
  --data-urlencode "uploadDate=week" \
  "https://youtube.fetcher.sh/api/search/video"
Most viewed, long-form only:
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "query=x402 protocol" -G \
  --data-urlencode "sortBy=view_count" \
  --data-urlencode "duration=long" \
  "https://youtube.fetcher.sh/api/search/video"
Newest first:
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "query=stablecoin payments" -G \
  --data-urlencode "sortBy=upload_date" \
  "https://youtube.fetcher.sh/api/search/video"
Other
uploadDate
values:
hour
,
today
,
month
,
year
. Other
duration
values:
short
,
medium
. Other
sortBy
values:
relevance
,
rating
.
Search channels or playlists:
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "query=lofi hip hop" -G \
  "https://youtube.fetcher.sh/api/search/channel"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "query=lofi hip hop" -G \
  "https://youtube.fetcher.sh/api/search/playlist"
A channel by ID, handle, or custom path — then its videos, shorts, and live streams:
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/channel/handle/mkbhd"

curl -H "Authorization: Bearer $FETCHER_API_KEY" -G \
  --data-urlencode "channelPath=@mkbhd" \
  "https://youtube.fetcher.sh/api/channel/path"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/channel/UCBJycsmduvYEL83R_U4JriQ/videos"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/channel/UCBJycsmduvYEL83R_U4JriQ/shorts"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/channel/UCBJycsmduvYEL83R_U4JriQ/live-streams"
A video's details and comments, or a short's details:
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/video/dQw4w9WgXcQ"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "sort=top" -G \
  "https://youtube.fetcher.sh/api/video/dQw4w9WgXcQ/comments"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/shorts/abc123XYZ90"
A playlist's videos, videos under a hashtag, and trending (by region):
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/playlist/PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI/videos"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/hashtag/shorts"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "geo=US" -G \
  "https://youtube.fetcher.sh/api/trending"
本周上传的视频:
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "query=ai agents" -G \
  --data-urlencode "uploadDate=week" \
  "https://youtube.fetcher.sh/api/search/video"
最多观看量的长视频:
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "query=x402 protocol" -G \
  --data-urlencode "sortBy=view_count" \
  --data-urlencode "duration=long" \
  "https://youtube.fetcher.sh/api/search/video"
按上传时间排序(最新优先):
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "query=stablecoin payments" -G \
  --data-urlencode "sortBy=upload_date" \
  "https://youtube.fetcher.sh/api/search/video"
uploadDate
的其他可选值:
hour
today
month
year
duration
的其他可选值:
short
medium
sortBy
的其他可选值:
relevance
rating
搜索频道或播放列表:
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "query=lofi hip hop" -G \
  "https://youtube.fetcher.sh/api/search/channel"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "query=lofi hip hop" -G \
  "https://youtube.fetcher.sh/api/search/playlist"
通过ID、handle或自定义路径查找频道,再获取其视频、短视频和直播流:
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/channel/handle/mkbhd"

curl -H "Authorization: Bearer $FETCHER_API_KEY" -G \
  --data-urlencode "channelPath=@mkbhd" \
  "https://youtube.fetcher.sh/api/channel/path"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/channel/UCBJycsmduvYEL83R_U4JriQ/videos"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/channel/UCBJycsmduvYEL83R_U4JriQ/shorts"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/channel/UCBJycsmduvYEL83R_U4JriQ/live-streams"
获取视频详情及评论,或短视频详情:
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/video/dQw4w9WgXcQ"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "sort=top" -G \
  "https://youtube.fetcher.sh/api/video/dQw4w9WgXcQ/comments"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/shorts/abc123XYZ90"
获取播放列表视频、话题标签下的视频以及地区热门视频:
bash
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/playlist/PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI/videos"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  "https://youtube.fetcher.sh/api/hashtag/shorts"

curl -H "Authorization: Bearer $FETCHER_API_KEY" \
  --data-urlencode "geo=US" -G \
  "https://youtube.fetcher.sh/api/trending"

MCP

MCP

json
{
  "mcpServers": {
    "youtube": {
      "url": "https://youtube.fetcher.sh/mcp",
      "headers": { "Authorization": "Bearer bby_live_..." }
    }
  }
}
Free:
search_endpoints
,
describe_endpoint
,
check_balance
. Paid:
fetch_data
(any endpoint above),
topup_credits
, plus the named shortcut
youtube_search_video
. Drop the
headers
block to pay per call with x402 instead — see the
fetcher
skill
for the full flow.
json
{
  "mcpServers": {
    "youtube": {
      "url": "https://youtube.fetcher.sh/mcp",
      "headers": { "Authorization": "Bearer bby_live_..." }
    }
  }
}
免费接口:
search_endpoints
describe_endpoint
check_balance
。付费接口:
fetch_data
(调用上述任意接口)、
topup_credits
,以及快捷方式
youtube_search_video
。若要改用 x402 按调用付费,可移除
headers
块——完整流程请查看
fetcher
技能

Errors

错误说明

  • 400
    — missing/invalid parameter (message names it)
  • 401
    — unknown or rotated key
  • 402
    — payment required (x402 challenge) or
    topup_required
    (credits exhausted)
  • 404
    — not a priced path
  • No rate limits; no refunds on upstream failures (settlement precedes delivery)
  • 400
    — 参数缺失/无效(错误信息会指明具体参数)
  • 401
    — 密钥未知或已过期
  • 402
    — 需要付费(x402 验证)或需要充值(余额耗尽)
  • 404
    — 该路径未定价
  • 无速率限制;上游服务故障时不予退款(结算先于数据交付)

Reference

参考链接