YouTube Trending Scraper API
Last updated: · REST · JSON
Send GET https://proxy.scrapier.io/api/v2/youtube-trending/?country_code=US with your key in the X-API-Key header. You get the page of trending videos back as JSON. 1 credit per page of trending videos; failed calls are free.
- 1 credit per page of trending videos
- Failed calls free
- 3 parallel requests per key
Call the YouTube Trending Scraper API
Use the YouTube Trending Scraper API from your own apps, scripts or agents. You need a Scrapier account and the API key from your dashboard. Pick a language.
import requests# Replace YOUR_API_KEY with the key from your Scrapier dashboardAPI_KEY = "YOUR_API_KEY"params = { "country_code": "US", "content_type": "music",}r = requests.get( "https://proxy.scrapier.io/api/v2/youtube-trending/", headers={"X-API-Key": API_KEY}, params=params, timeout=210,)r.raise_for_status()# The result sits under data.videosresult = r.json()["data"]["videos"]print(result)
// Replace YOUR_API_KEY with the key from your Scrapier dashboardconst API_KEY = "YOUR_API_KEY";const params = new URLSearchParams({ country_code: "US", content_type: "music",});const res = await fetch(`https://proxy.scrapier.io/api/v2/youtube-trending/?${params}`, { headers: { "X-API-Key": API_KEY }, signal: AbortSignal.timeout(210_000),});if (!res.ok) throw new Error(`HTTP ${res.status}`);const { data } = await res.json();console.log(data.videos);
# One GET request. The key goes in a header, never in the URL.GET /api/v2/youtube-trending/?country_code=US&content_type=music HTTP/1.1Host: proxy.scrapier.ioX-API-Key: YOUR_API_KEYAccept: application/json
# Scrapier publishes an OpenAPI spec that covers every endpoint. No API key needed.curl -O https://proxy.scrapier.io/api/v2/openapi.json# Import openapi.json into Postman, Insomnia, Bruno or a code generator,# then add your key as the X-API-Key header.
# 1. Add the Scrapier MCP server to Claude Codeclaude mcp add -t http scrapier https://mcp.scrapier.io/mcp --header "X-API-Key: YOUR_API_KEY"# 2. Ask your agent. It finds the endpoint with search_endpoints# and calls it with run_scrape:"Show the YouTube trending music videos in the US"run_scrape("youtube-trending", {country_code: "US"})
YouTube Trending Scraper API in Python
Plain requests is all you need — no SDK. Every response is typed JSON.
Install
YouTube Trending Scraper API in JavaScript
Works in Node 18+, Deno, Bun and edge runtimes with the built-in fetch.
Check your setup
YouTube Trending Scraper API over HTTP
One GET request. Auth is a single X-API-Key header.
Check your setup
YouTube Trending Scraper API OpenAPI definition
Download the spec once, then import it into the tools you already use. No key is needed to fetch it.
Download the spec
YouTube Trending Scraper API over MCP
The same endpoint is a tool call for Claude Code, Cursor and Windsurf. Same country_code, same 1 credit per page of trending videos.
Install
Other ways to call it
YouTube Trending Scraper API Interactive Playground
Edit the request, watch the code update, then run it. Without a key it shows the catalog sample and bills nothing. With your key it makes a real call from your browser; the key goes only to proxy.scrapier.io and is never stored.
GET /api/v2/youtube-trending/?country_code=USPress Run request to send it. Without a key you get the catalog sample.
Failed calls are not billed.
The sample is the same for every input: it shows the response shape, not the account you typed.
Example response, catalog sample from 9 Nov 2026
{
"success": true,
"data": {
"country_code": "US",
"content_type": "music",
"page": 1,
"page_size": 25,
"videos": [
{
"type": "video",
"id": "V-uIp-WuD60",
"video_id": "V-uIp-WuD60",
"title": "Patient Zero",
"status": "OK",
"url": "https://www.youtube.com/watch?v=V-uIp-WuD60",
"description": "Provided to YouTube by Universal Music Group\n\nPatient Zero · Taylor Swift\n\nThe Life of a Showgirl: The Encore\n\n℗ 2026 Taylor Swift\n\nReleased on: 2026-09-25\n\nCom",
"duration": 226,
"views": "6722880",
"view_count": 6722880,
"likes": "95077",
"like_count": 95077,
"comments": null,
"channel": {
"id": "UCPC0L1d253x-KuMNwa05TpA",
"name": "Taylor Swift - Topic",
"handle": null,
"url": "https://www.youtube.com/channel/UCPC0L1d253x-KuMNwa05TpA",
"subscriber_count": null,
"thumbnails": [],
"badges": []
},
"channel_id": "UCPC0L1d253x-KuMNwa05TpA",
"channel_name": "Taylor Swift - Topic",
"keywords": [
"Taylor Swift",
"テイラースウィフト",
"テイラー・スウィフト"
],
"is_ratings_allowed": true,
"is_live": false,
"is_live_content": false,
"is_family_safe": true,
"category": "Music",
"is_private": false,
"is_exclusive": false,
"thumbnails": [
{
"url": "https://i.ytimg.com/vi/V-uIp-WuD60/maxresdefault.jpg",
"width": 1920,
"height": 1080
}
],
"embed_url": "https://www.youtube.com/embed/V-uIp-WuD60",
"is_embeddable": true,
"is_unlisted": false,
"publish_date": "2026-09-24T21:02:10-07:00",
"published_at": "2026-09-24T21:02:10-07:00",
"relative_date": null,
"upload_date": "2026-09-24T21:02:10-07:00",
"trending_position": 1,
"previous_position": null,
"periods_on_chart": null,
"chart_view_count": null,
"artists": [
"Taylor Swift"
],
"release_date": "2026-09-24",
"country_code": "US",
"content_type": "music",
"source": "youtube_charts",
"chart_type": "TRENDING_VIDEOS",
"enriched": true,
"scraped_at": "2026-10-03T04:28:40.122Z"
}
],
"next_cursor": "eyJjdCI6Im11c2ljIiwiaSI6IlVTIiwicCI6Miwic24iOlsiMGExYjJjIl19"
}
}Data You Can Extract
YouTube Trending Scraper extracts a trending chart per call: rank, video title and URL, views, likes, channel, category, publish date, thumbnails and, for music, the artists. Every field below comes from the catalog sample response, as typed JSON.
Video
12 fields in the response.
- type
- id
- video_id
- title
- status
- url
- description
- duration
- +4 more
Reach and engagement
5 fields in the response.
- views
- view_count
- likes
- like_count
- comments
Chart position
9 fields in the response.
- trending_position
- previous_position
- periods_on_chart
- chart_view_count
- chart_type
- source
- enriched
- country_code
- +1 more
Channel
3 fields in the response.
- channel
- channel_id
- channel_name
Dates
5 fields in the response.
- publish_date
- published_at
- relative_date
- upload_date
- scraped_at
Flags and media
10 fields in the response.
- is_ratings_allowed
- is_live
- is_live_content
- is_family_safe
- is_private
- is_exclusive
- is_embeddable
- is_unlisted
- +2 more
Response envelope and paging
6 fields in the response.
- success
- data.country_code
- data.content_type
- data.page
- data.page_size
- data.next_cursor
Response Schema Reference
Every field in the sample response. Field names stay the same on every call.
| Field | Type | Example | Description |
|---|---|---|---|
videos.type | string | "video" | Record type, video in the sample |
videos.id | string | "V-uIp-WuD60" | YouTube video ID |
videos.video_id | string | "V-uIp-WuD60" | YouTube video ID (same value as id) |
videos.title | string | "Patient Zero" | Title of the video |
videos.status | string | "OK" | Availability status, OK in the sample |
videos.url | string | "https://www.youtube.com/watch?v=V-uIp-WuD60" | Watch URL |
videos.description | string | "Provided to YouTube by Universal Music Grou…" | Video description text |
videos.duration | integer | 226 | Length in seconds |
videos.category | string | "Music" | YouTube category, such as Music |
videos.keywords | array | 5 items | List of keywords of the video |
videos.artists | array | 1 items | List of artist names for music |
videos.release_date | string | "2026-09-24" | Release date (YYYY-MM-DD) |
videos.views | string | "6722880" | View count as a string |
videos.view_count | integer | 6722880 | View count as a number |
videos.likes | string | "95077" | Like count as a string |
videos.like_count | integer | 95077 | Like count as a number |
videos.comments | null | null | Comment count; null when not available |
videos.trending_position | integer | 1 | Rank on the chart |
videos.previous_position | null | null | Previous rank; null when not available |
videos.periods_on_chart | null | null | Periods on the chart; null when not available |
videos.chart_view_count | null | null | Chart view count; null when not available |
videos.chart_type | string | "TRENDING_VIDEOS" | Chart kind, such as TRENDING_VIDEOS |
videos.source | string | "youtube_charts" | Where the chart comes from, youtube_charts in the sample |
videos.enriched | boolean | true | true when details were added to the chart row |
videos.country_code | string | "US" | Country of the chart |
videos.content_type | string | "music" | Chart type you asked for |
videos.channel | object | {…} | Channel object: id, name, handle, url, subscriber_count, thumbnails, badges |
videos.channel_id | string | "UCPC0L1d253x-KuMNwa05TpA" | UC channel ID |
videos.channel_name | string | "Taylor Swift - Topic" | Channel name |
videos.publish_date | string | "2026-09-24T21:02:10-07:00" | Publish date with time zone offset |
videos.published_at | string | "2026-09-24T21:02:10-07:00" | Publish time (ISO 8601) |
videos.relative_date | null | null | Relative date text; null in the sample |
videos.upload_date | string | "2026-09-24T21:02:10-07:00" | Upload time (ISO 8601) |
videos.scraped_at | string | "2026-10-03T04:28:40.122Z" | When Scrapier read the chart (ISO 8601, UTC) |
videos.is_ratings_allowed | boolean | true | true when ratings are allowed |
videos.is_live | boolean | false | true when the video is live |
videos.is_live_content | boolean | false | true for live or past-live content |
videos.is_family_safe | boolean | true | true when marked family safe |
videos.is_private | boolean | false | true when the video is private |
videos.is_exclusive | boolean | false | true when the video is exclusive |
videos.is_embeddable | boolean | true | true when the video can be embedded |
videos.is_unlisted | boolean | false | true when the video is unlisted |
videos.thumbnails | array | 1 items | List of thumbnails with url, width and height |
videos.embed_url | string | "https://www.youtube.com/embed/V-uIp-WuD60" | Embeddable player URL |
success | boolean | true | true on every 200 response |
data.country_code | string | "US" | Country of the chart |
data.content_type | string | "music" | Chart you asked for |
data.page | integer | 1 | Page number of this response |
data.page_size | integer | 25 | Videos per page |
data.next_cursor | string | "eyJjdCI6Im11c2ljIiwiaSI6IlVTIiwicCI6Miwic24…" | Pass back as cursor for the next page; null on the last page |
Request Parameters Reference
| Name | Type | Required | Default | Description | Example |
|---|---|---|---|---|---|
country_code | string | Yes | — | Two-letter ISO country code, such as US, BD, IN or GB. One per call. Required on the first call; ignored when cursor is supplied. Alias: country | US |
cursor | string | No | — | Pass back data.next_cursor from the previous response to get the next page; null means the last page | — |
content_type | string | No | music | The chart: music (default, 30 videos; regions without that chart fall back to daily top music videos), movies (trending trailers, 30), top_music_videos (100), gaming, sports, news, live, learning or fashion. Invalid value returns 400. Locked in the cursor. Alias: category | music |
use_proxy | boolean | No | true | Route through Scrapier's residential proxy pool. Leave as is | true |
raw_data | boolean | No | false | Return YouTube's raw upstream payload under raw_responses instead of the formatted items | true |
One country and one chart per call: to cover ten markets, make ten calls and page each with cursor. Booleans are the strings true or false.
Pagination in the YouTube Trending Scraper API
The YouTube Trending Scraper API returns results in pages. Pass data.next_cursor back as cursor to get the next page; when it is null there are no more. Each successful call, first page or later, costs 1 credit.
Access Without YouTube Login
The YouTube Trending Scraper API needs no YouTube account, no login and no session cookies. You send your Scrapier key in the X-API-Key header and get JSON back. It reads public data only: what any visitor sees without logging in.
Speed, Cost and Concurrency
| Metric | Value | Source |
|---|---|---|
| Cost of a successful call | 1 credit | Scrapier catalog |
| Cost of a failed call | 0 credits | Any non-2xx response |
| Parallel requests per key | 3 | Above that: 429 with Retry-After |
| Recommended client timeout | 210 seconds | Scrapier docs, every endpoint |
Latency of the YouTube Trending Scraper API
Scrapier does not publish a latency or success-rate figure for this endpoint. Each call reads YouTube at call time, so response time depends on YouTube and on the size of the result. Set a client timeout of 210 seconds, as the docs recommend for every endpoint.
Limits of the Endpoint
Honest constraints of the YouTube Trending Scraper API.
- Public data only.
- A failed call, for example a missing or unavailable page of trending videos, returns a non-2xx status and costs 0 credits.
- Data is read live at call time.
- 3 parallel requests per key; above that the API answers
429withRetry-After. - Large results come in pages; pass
data.next_cursorback ascursor. - Fields YouTube does not show are not returned.
Scrapier vs the Official YouTube API
The official YouTube Data API is the better choice when you build an app that must follow Google's API terms and only needs its most-popular list.
| Feature | Scrapier page of trending videos scraper | Official YouTube API |
|---|---|---|
| Access needed | One Scrapier API key | A Google Cloud project, an API key and a daily quota |
| Which charts | Music, trailers, top music, gaming, sports, news, live, learning and fashion, by country | A most-popular videos list by region and category through the videos resource |
| Fields returned | 44 fields per ranked video, including chart position and artists | Depends on the resource and parts you request |
| Rate limits | Up to 3 parallel requests per key; 429 with Retry-After | Daily quota units set per Google Cloud project |
| Setup | Sign up, copy a key, send a request | Create a project, enable the API, create credentials |
| Cost | 1 credit per page, from $1.20 per 1,000 pages | Free within quota; more needs a quota extension request |
Errors and Retry Handling
| Status | Meaning | Billed | Fix |
|---|---|---|---|
| 200 | Page of trending videos data returned in data.videos | Yes | — |
| 400 | Bad or missing input | No | Check country_code: one value per call |
| 401 | X-API-Key header missing | No | Add the header |
| 402 | Out of credits (body has balance) | No | Top up; retrying will not help |
| 403 | Invalid or revoked API key | No | Check the key in your dashboard |
| 429 | Throttled | No | Wait Retry-After seconds, then retry |
| 5xx | Upstream failure or timeout | No | Retry with backoff; set a 210 s client timeout |
From the error reference. Any non-2xx response costs 0 credits.
Retry logic for the YouTube Trending Scraper API
import time, requests def get_trending(value, key, tries=5): for attempt in range(tries): r = requests.get( "https://proxy.scrapier.io/api/v2/youtube-trending/", headers={"X-API-Key": key}, params={"country_code": value}, timeout=210, ) if r.status_code == 429: time.sleep(int(r.headers.get("Retry-After", 2 ** attempt))) elif r.status_code >= 500: time.sleep(2 ** attempt) else: r.raise_for_status() return r.json() raise RuntimeError("gave up after retries")
Pricing and Rate Limits
| Plan | Monthly price | Pages Of Trending Videos included | Cost per 1,000 |
|---|---|---|---|
| Hobby | $29 | 15,000 | $1.93 |
| Pro | $79 | 50,000 | $1.58 |
| Scale | $299 | 250,000 | $1.20 |
Billing rules for the YouTube Trending Scraper API
The YouTube Trending Scraper API bills 1 credit per successful page of trending videos. Failed calls, meaning any non-2xx status, cost 0 credits. Every plan allows 3 parallel requests per key. The free tier lets you try it before you pay.
Bulk Lookups and CSV
country_code takes one value per call. For a list, loop and run up to 3 requests in parallel per key, then flatten each row into one CSV line.
import csv, requests from concurrent.futures import ThreadPoolExecutor values = ["US"] # your list def fetch(value): r = requests.get( "https://proxy.scrapier.io/api/v2/youtube-trending/", headers={"X-API-Key": "YOUR_API_KEY"}, params={"country_code": value}, timeout=210, ) r.raise_for_status() out = r.json()["data"]["videos"] return out if isinstance(out, list) else [out] # 3 parallel requests per key is the limit with ThreadPoolExecutor(max_workers=3) as pool: rows = [row for part in pool.map(fetch, values) for row in part] cols = ["trending_position", "title", "channel_name", "view_count", "like_count", "category"] with open("out.csv", "w", newline="") as f: w = csv.DictWriter(f, fieldnames=cols, extrasaction="ignore") w.writeheader() w.writerows(rows)
CSV export from the YouTube Trending Scraper API
trending_position,title,channel_name,view_count,like_count,category 1,Patient Zero,Taylor Swift - Topic,6722880,95077,Music
AI Agent Access via MCP
MCP for the YouTube Trending Scraper API
The same endpoint is available to AI agents through the Scrapier MCP server at https://mcp.scrapier.io/mcp. One command registers it in Claude Code: claude mcp add -t http scrapier https://mcp.scrapier.io/mcp --header "X-API-Key: YOUR_API_KEY". The agent finds the endpoint with search_endpoints and calls it with run_scrape and the endpoint id youtube-trending. It takes the same country_code input and costs the same 1 credit per page of trending videos. Setup for every client is on the YouTube Trending Scraper MCP page.
Integration Paths by Role
n8n and Make
- Add an HTTP Request step
- GET the endpoint with your
X-API-Keyheader - Map the
data.videosfields to your columns
Loop and paginate
MCP tool in your agent
Call run_scrape with endpoint youtube-trending from Claude, Cursor or Windsurf. Setup is on the MCP page.
CSV and flattened JSON
Flatten each row into one CSV line, one column per field, ready for Sheets, Excel or a BI tool.
Legal and Compliance Notes
Scraping publicly available YouTube data is generally lawful in many countries, but the answer depends on what you collect, where you are and how you use it. In the US, hiQ Labs v. LinkedIn is the case most often cited on public-data scraping. Scrapier returns only data any visitor can see without logging in. Under GDPR and similar laws, collecting public data can be permissible, but how you store and use personal data, such as names or comment text, must still comply with local data-protection rules, and YouTube's terms apply. Consult legal counsel if your use case involves bulk storage of personal data. This is not legal advice; see our Terms of Use.
Frequently Asked Questions
Is there a YouTube page of trending videos API?
Yes. Scrapier's YouTube Trending Scraper API returns any public page of trending videos as JSON with one GET request and an X-API-Key header. No YouTube app or login.
How do I call it from Python?
Use <code>requests.get</code> on <code>https://proxy.scrapier.io/api/v2/youtube-trending/</code> with <code>params={'country_code': 'US'}</code> and <code>headers={"X-API-Key": KEY}</code>. Read <code>r.json()["data"]["videos"]</code>.
What happens when a call fails?
Any non-200 response is free. Retry 429 and 5xx with backoff; the API already retries upstream failures.
How much does it cost?
1 credit per successful call — about $1.58 per 1,000 pages of trending videos on the Pro plan. Failed calls are free.
Is there an OpenAPI spec?
Yes. It needs no key and covers every Scrapier endpoint.
Related YouTube APIs
Trending Shorts API
Shorts from a hashtag feed such as #trendingshorts, by country, with sort options.
Hashtag Videos API
Videos and Shorts under a hashtag, with channel, views and publish date.
Video Details API
One video by URL: title, channel, description, views, likes, duration, tags and upload date.
All YouTube APIs
All 17 YouTube endpoints.
Fetch public YouTube pages of trending videos as typed JSON in one request
1 credit per page of trending videos · failed calls free