跳转到主要内容
GET
/
v1
/
youtube
/
get_trending_videos
cURL
curl --request GET \
  --url 'https://api.keyapi.ai/v1/youtube/get_trending_videos?language_code=en&country_code=US&section=Music' \
  --header 'Authorization: Bearer <YOUR_API_KEY>'
import requests

response = requests.get(
    'https://api.keyapi.ai/v1/youtube/get_trending_videos',
    params={"language_code": "en", "country_code": "US", "section": "Music"},
    headers={'Authorization': 'Bearer <YOUR_API_KEY>'}
)
print(response.json())
const params = new URLSearchParams({"language_code": "en", "country_code": "US", "section": "Music"});

const response = await fetch(`https://api.keyapi.ai/v1/youtube/get_trending_videos?${params}`, {
  method: 'GET',
  headers: { 'Authorization': 'Bearer <YOUR_API_KEY>' }
});
const data = await response.json();
console.log(data);
{
  "code": 0,
  "message": "success",
  "data": {
    "detail": "Could not get trending videos for US"
  },
  "requestId": "bcb49c86-61c9-4a4f-9fbf-8380b6fb9536"
}
{
  "code": 400,
  "data": null,
  "message": "Missing required parameter: handle"
}
{
  "code": 401,
  "data": null,
  "message": "apiKey is null"
}
{
  "code": 402,
  "data": null,
  "message": "apiKey quota is not enough"
}
{
  "code": 429,
  "data": null,
  "message": "qps limit exceeded"
}
{
  "code": 500,
  "data": null,
  "message": "Internal server error"
}
🪙3 credits每次请求

Copy for AI

🤖 让 AI 帮你写调用代码

点击按钮复制一段结构化提示词,可直接交给 ChatGPT、Claude 或其他 AI 助手生成接口调用代码。

授权

Authorization
string
header
必填

接口鉴权凭证。请在请求 Header 中传入 Authorization: Bearer <YOUR_API_KEY>。 可在 Dashboard 获取你的 API Key。

查询参数

language_code
string
默认值:en

语言代码,默认为en

country_code
string
默认值:US

国家代码,默认为US

section
string
默认值:Now

类型,默认为Now,可选值:Music, Gaming, Movies。

响应

请求成功

The response is of type object.