YouTubeトレンドAPI

任意の国やカテゴリの「最も人気」な動画をリアルタイムで取得します。

何ができますか?
デイリートレンドフィードを取得

YouTubeから直接、公式の「最も人気」リストを取得します。

任意の国でフィルタ

任意のISO-3166国コードを指定(US、GB、IN...)。

カテゴリと制限オプション

音楽(10)、ゲーム(20)などに絞り込み、最大50件。

ライブで試す
99.9 % 稼働時間
80.9ms レスポンス
20 req/s
0.01 クレジット / リクエスト

Trending List


POST https://api.yeb.to/v1/youtube/trending
パラメータ必須説明
api_key string はい Your API key
country string 任意 ISO-3166 code (default US)
category int 任意 YouTube category ID (e.g. 10 = Music)
limit int 任意 1-50 results (default 20)

curl -X POST https://api.yeb.to/v1/youtube/trending \
  -H "Content-Type: application/json" \
  -d '{
  "api_key":  "YOUR_KEY",
  "country":  "GB",
  "category": "10",
  "limit":    25
}'

レスポンス例

{
  "data": {
    "country":     "GB",
    "category":    "10",
    "cnt_results": 1,
    "videos": [
      {
        "id":           "abc123XYZ",
        "title":        "Top UK Hit 2025",
        "description":  "Official video…",
        "channelId":    "UCmusic",
        "channelTitle": "HitsNow",
        "publishedAt":  "2025-07-06T17:01:02Z",
        "categoryId":   "10",
        "durationISO":  "PT3M12S",
        "viewCount":    4500000,
        "likeCount":    128000,
        "commentCount": 9800,
        "thumb":        "https://i.ytimg.com/vi/abc123XYZ/hqdefault.jpg"
      }
    ]
  }
}
{"error":"Invalid country code. Use ISO 3166-1 alpha-2 format.","code":400}

レスポンスコード

コード説明
200 Successリクエスト処理成功。
400 Bad Request入力バリデーション失敗。
401 UnauthorizedAPIキーが不足または不正。
403 Forbiddenキーが無効または許可されていません。
429 Rate Limitリクエストが多すぎます。
500 Server Error予期しないエラー。

Trending List

youtube/trending 0.0100 credits

Parameters

API Key
body · string · required
Country
body · string
Category
body · string
Limit
body · string

Code Samples


                
                
                
            

Response

Status:
Headers

                
Body

                

YouTubeトレンドAPI — Practical Guide

A hands-on guide to building “what’s hot now” experiences with YouTube Trending: when to use it, the few parameters that matter, how to read the payload, and how to turn results into cards, playlists, and editorial blocks.

#What YouTube Trending solves

youtube/trending gives a live snapshot of the most popular videos per country, optionally focused on a specific YouTube category (e.g., 10 = Music). Use it for landing pages, auto-curated playlists, “Top Today” widgets, and weekly editorial picks.

#Endpoint & when to use it

  • Best for: Country dashboards, “New & Hot” rows, music-only charts (category=10).
  • Output: Compact list of videos with id, title, channelId/channelTitle, publishedAt, categoryId, durationISO, counts, and a ready-to-use thumb.
  • Tip: Cache per country for 5–10 minutes to reduce feed jitter and API costs.

#Quick start

# GB Music — Top 25
curl -X POST "https://api.yeb.to/v1/youtube/trending" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: <YOUR_API_KEY>" \
  -d '{
    "country":  "GB",
    "category": "10",
    "limit":    25
  }'
# US default — Mixed categories, 12 items
curl -X POST "https://api.yeb.to/v1/youtube/trending" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: <YOUR_API_KEY>" \
  -d '{ "limit": 12 }'

#Parameters that actually matter

ParamTypeRequiredPractical guidance
api_key string Yes Your API credential. Keep it server-side or use a signed token at the edge.
country string No ISO-3166-1 alpha-2 (e.g., US, GB, DE). Defaults to US. Match your site’s locale.
category int No YouTube category ID. Use 10 for Music. See the YouTube ID reference.
limit int No 1–50 (default 20). Trim to your UI grid (e.g., 8, 12, 24).

#Reading & acting on responses

{
  "data": {
    "country": "GB",
    "category": "10",
    "cnt_results": 1,
    "videos": [
      {
        "id":           "abc123XYZ",
        "title":        "Top UK Hit 2025",
        "description":  "Official video…",
        "channelId":    "UCmusic",
        "channelTitle": "HitsNow",
        "publishedAt":  "2025-07-06T17:01:02Z",
        "categoryId":   "10",
        "durationISO":  "PT3M12S",
        "viewCount":    4500000,
        "likeCount":    128000,
        "commentCount": 9800,
        "thumb":        "https://i.ytimg.com/vi/abc123XYZ/hqdefault.jpg"
      }
    ]
  }
}
  • id — YouTube Video ID. Build links: https://www.youtube.com/watch?v={id}.
  • channelId — Channel ID for badges or deep links: https://www.youtube.com/channel/{channelId}.
  • thumb — Ready “high” thumbnail. Derive sizes via i.ytimg.com/vi/{id}/….
  • durationISO — ISO-8601 (PT#M#S). Convert to mm:ss labels for cards.
  • publishedAt — UTC timestamp. Show “NEW” if < 72h old.
  • viewCount — Snapshot for social proof; trending is volatile, don’t over-sort by it alone.
PHP helper — ISO-8601 duration → mm:ss
$int = new DateInterval('PT3M12S'); $sec = $int->h*3600 + $int->i*60 + $int->s; $label = sprintf('%02d:%02d', floor($sec/60), $sec%60);

#Practical recipes

  • Music-only grid: Call with {"country":"DE","category":10,"limit":12}. Render thumb, title, channel, mm:ss, and a small views chip.
  • Weekly editorial: Cache by country for 7 days, but refresh every hour to catch breakouts; pin manually selected IDs on top.
  • Playlist builder: De-dupe by channelId to avoid stacking multiple uploads from the same channel.
  • Edge caching: Key on country + category; TTL 300–600s keeps UIs stable without feeling stale.

#YouTube IDs you’ll work with

FieldWhat it isHow to use
id (Video ID) 11-char video identifier Watch URL: https://www.youtube.com/watch?v={id} · Thumbs: https://i.ytimg.com/vi/{id}/hqdefault.jpg
channelId Channel identifier Channel URL: https://www.youtube.com/channel/{channelId}
categoryId Numeric category See common IDs below; 10 = Music

#Common YouTube Category IDs

IDCategory
1Film & Animation
2Autos & Vehicles
10Music
17Sports
20Gaming
22People & Blogs
23Comedy
24Entertainment
25News & Politics
26Howto & Style
27Education
28Science & Technology
29Nonprofits & Activism

Availability of categories can vary by region; 10 is universally safe for music use-cases.

#Errors & troubleshooting

  • 400 "Invalid country code. Use ISO 3166-1 alpha-2 format." — Two uppercase letters (e.g., US, GB).
  • 400 "Invalid category. Must be a numeric YouTube category ID." — Provide an integer like 10.
  • 502 "YouTube API error: …" — Upstream hiccup. Retry with exponential backoff (1s → 2s → 4s) and respect quotas.

#API Changelog (youtube/trending)

2026-03-07
Field guidance added. Practical notes for id, channelId, durationISO, and thumb; added YouTube ID reference section.
2026-03-07
Category docs. Clarified category=10 for Music and listed common Category IDs for quick selection.
2026-02-21
Unified wrapper. Standardized the top-level payload to {"data":{...}} and added cnt_results.
2026-02-14
Error surface. Consistent 400 validation (country, category) and 502 for upstream YouTube failures.

よくある質問

YouTube自体は約15分ごとにリストを更新します。APIはリクエスト時にライブのものを表示します。

数値です:10 = 音楽、17 = スポーツ、20 = ゲーム、24 = エンターテインメントなど。完全な表はYouTube Data APIドキュメントを参照してください。

はい。エラーが発生したリクエストを含め、すべてのリクエストがクレジットを消費します。クレジットは成功・失敗に関係なくリクエスト数に紐づいています。エラーが明らかに当社のプラットフォーム側の問題による場合は、影響を受けたクレジットを復元します(現金での返金はありません)。

[email protected]までご連絡ください。フィードバックを真摯に受け止めています。バグレポートや機能リクエストが意味のあるものであれば、APIを迅速に修正・改善し、お礼として50の無料クレジットを付与します。

APIやエンドポイントによって異なります。一部のエンドポイントは外部ソースのデータを使用しており、より厳しい制限がある場合があります。また、不正利用の防止とプラットフォームの安定性維持のために制限を設けています。各エンドポイントの具体的な制限についてはドキュメントをご確認ください。

クレジットシステムで運営しています。クレジットは前払いの返金不可の単位で、API呼び出しやツールに使用します。クレジットはFIFO(古いものから順に)消費され、購入日から12か月間有効です。ダッシュボードに各購入日とその有効期限が表示されます。

はい。購入したすべてのクレジット(端数残高を含む)は購入から12か月間有効です。未使用のクレジットは有効期間終了時に自動的に期限切れとなり、永久に削除されます。期限切れのクレジットは復元や現金その他の価値への変換はできません。経過措置:2025年9月22日以前に購入したクレジットは2025年9月22日購入として扱われ、2026年9月22日に期限切れとなります(購入時により早い期限が記載されていない限り)。

はい—有効期間内で繰り越されます。未使用のクレジットは利用可能な状態のまま月ごとに繰り越され、購入後12か月で期限切れになります。

クレジットは返金不可です。必要な分だけ購入してください—後からいつでもチャージできます。プラットフォーム側のエラーで課金に失敗した場合、調査後に影響を受けたクレジットを復元する場合があります。現金での返金はありません。

料金はドルではなくクレジットで設定されています。各エンドポイントには独自のコストがあります—上記の「クレジット / リクエスト」バッジをご覧ください。常に正確な支出額がわかります。
← APIに戻る