YouTube Trending API

Haal "populairste" video's op voor elk land of elke categorie in realtime.

Wat kunt u doen?
Dagelijkse trendingfeed ophalen

Haal de officiële "Populairste"-lijst rechtstreeks van YouTube.

Filter op elk land

Geef elke ISO-3166-landcode op (US, GB, IN...).

Categorie- & limietopties

Beperk tot Muziek (10), Gaming (20) & meer, maximaal 50 resultaten.

Live proberen
99.9 % Beschikbaarheid
80.9ms Antwoord
20 req/s
0.01 Credits / verzoek

Trending List


POST https://api.yeb.to/v1/youtube/trending
ParameterTypeVerpl.Beschrijving
api_key string ja Your API key
country string opt. ISO-3166 code (default US)
category int opt. YouTube category ID (e.g. 10 = Music)
limit int opt. 1-50 results (default 20)

Voorbeeld

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
}'

Antwoordvoorbeeld

{
  "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}

Antwoordcodes

CodeBeschrijving
200 SuccessVerzoek succesvol verwerkt.
400 Bad RequestInvoervalidatie mislukt.
401 UnauthorizedOntbrekende / onjuiste API-sleutel.
403 ForbiddenSleutel inactief of niet toegestaan.
429 Rate LimitTe veel verzoeken.
500 Server ErrorOnverwachte fout.

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 Trending 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.

Veelgestelde vragen

YouTube zelf ververst de lijst ongeveer elke 15 minuten; de API toont wat er live is op het moment van het verzoek.

Het zijn nummers: 10 = Muziek, 17 = Sport, 20 = Gaming, 24 = Entertainment, enz. Zie de YouTube Data API-documentatie voor de volledige tabel.

Ja. Elk verzoek, zelfs die met fouten, verbruikt credits. Uw credits zijn gekoppeld aan het aantal verzoeken, ongeacht succes of falen. Als de fout duidelijk te wijten is aan een platformprobleem aan onze kant, herstellen we de getroffen credits (geen geldteruggave).

Neem contact met ons op via [email protected]. We nemen feedback serieus—als uw bugrapport of functieverzoek zinvol is, kunnen we de API snel repareren of verbeteren en u 50 gratis credits geven als dank.

Het hangt af van de API en soms zelfs van het endpoint. Sommige endpoints gebruiken gegevens van externe bronnen, die strengere limieten kunnen hebben. We handhaven ook limieten om misbruik te voorkomen en ons platform stabiel te houden. Raadpleeg de documentatie voor de specifieke limiet van elk endpoint.

We werken met een creditsysteem. Credits zijn vooruitbetaalde, niet-restitueerbare eenheden die u besteedt aan API-aanroepen en tools. Credits worden verbruikt volgens FIFO (oudste eerst) en zijn geldig voor 12 maanden vanaf de aankoopdatum. Het dashboard toont elke aankoopdatum en de vervaldatum.

Ja. Alle gekochte credits (inclusief fractionele saldi) zijn geldig voor 12 maanden na aankoop. Ongebruikte credits verlopen automatisch en worden permanent verwijderd aan het einde van de geldigheidsperiode. Verlopen credits kunnen niet worden hersteld of omgezet in contant geld of andere waarde. Overgangsregel: credits gekocht vóór 22 sep. 2025 worden behandeld als gekocht op 22 sep. 2025 en verlopen op 22 sep. 2026 (tenzij een eerdere vervaldatum werd vermeld bij aankoop).

Ja—binnen hun geldigheidsperiode. Ongebruikte credits blijven beschikbaar en worden van maand tot maand overgedragen totdat ze 12 maanden na aankoop verlopen.

Credits zijn niet-restitueerbaar. Koop alleen wat u nodig heeft—u kunt altijd later bijvullen. Als een platformfout een mislukte afschrijving veroorzaakt, kunnen we de getroffen credits herstellen na onderzoek. Geen geldteruggave.

Prijzen worden vastgesteld in credits, niet in dollars. Elk endpoint heeft zijn eigen kosten—zie de badge "Credits / verzoek" hierboven. U weet altijd precies wat u uitgeeft.
← Terug naar API's