Skip to main content

YouTube Scraper API

Search YouTube, pull full video and Shorts detail, fetch comments and replies, export transcripts (SRT/VTT/plain text), enumerate a channel’s videos, shorts, streams, playlists, and community posts, and retrieve trending feeds, hashtags, and playlists — from the world’s largest video platform. The API handles authentication, anti-bot bypass, and region routing automatically.

Key Features

Widest Coverage

39 endpoints — videos, Shorts, channels, playlists, comments, transcripts, trending, hashtags, community posts, and music search.

Transcripts & Captions

The /v1/youtube/videos/{id}/transcript endpoint returns timed segments plus ready-to-use SRT, VTT, and full-text exports.

Anti-Bot Bypass

Automatic session management, Chrome TLS impersonation, and fingerprint rotation to avoid blocks.

Rich Video Data

Views, likes, chapters, heatmap (most-replayed), keywords, hashtags, live details, and streaming formats.

Region & Language

Target any content region with gl and any UI language with hl for accurate, localized results.

SDK Support

First-class support via the ScrapeBadger Node.js and Python SDKs.

Regions & Languages

YouTube results are localized by content region and UI language. Two query parameters control this on most endpoints:
ParameterMeaningExample
glContent region (ISO 3166-1 alpha-2 country code)US, GB, DE, JP
hlUI / interface language (BCP-47 language code)en, de, fr, ja
If omitted, gl defaults to US and hl defaults to en. Use the free /v1/youtube/regions and /v1/youtube/languages reference endpoints to fetch the full list of valid codes programmatically.

Pagination

YouTube list endpoints do not use page numbers. Every paginated response includes a continuation token; pass it back as the continuation query parameter to fetch the next page. When continuation is null, you have reached the end.

Quick Start

import ScrapeBadger from "scrapebadger";

const client = new ScrapeBadger({ apiKey: "YOUR_API_KEY" });

const results = await client.youtube.search({
  query: "lofi hip hop",
  gl: "US",
  hl: "en",
});

console.log(results.results);

Endpoints

Search & Discovery

EndpointMethodDescription
/v1/youtube/searchGETSearch videos, channels, playlists, or movies
/v1/youtube/autocompleteGETKeyword autocomplete suggestions
/v1/youtube/trendingGETTrending feed (Now / Music / Gaming / Movies)
/v1/youtube/trending/shortsGETTrending Shorts shelf
/v1/youtube/hashtags/{tag}GETVideos under a hashtag
/v1/youtube/homeGETGuest home / recommendations feed
/v1/youtube/music/searchGETYouTube Music search (songs, albums, artists)

Videos & Shorts

EndpointMethodDescription
/v1/youtube/videos/{video_id}GETFull video detail
/v1/youtube/videos/batchPOSTUp to 50 videos in one request
/v1/youtube/videos/{video_id}/relatedGETRelated / recommended videos
/v1/youtube/videos/{video_id}/commentsGETTop-level comments
/v1/youtube/videos/{video_id}/comments/{comment_id}/repliesGETReplies to a comment
/v1/youtube/videos/{video_id}/transcriptGETTimed transcript (SRT / VTT / text)
/v1/youtube/videos/{video_id}/captionsGETAvailable caption tracks
/v1/youtube/videos/{video_id}/streamsGETStreaming formats (best-effort URLs)
/v1/youtube/videos/{video_id}/live_chatGETLive chat / chat replay messages
/v1/youtube/shorts/{video_id}GETFull Shorts detail
/v1/youtube/shorts/by_sound/{sound_id}GETShorts using a given sound

Channels

EndpointMethodDescription
/v1/youtube/channels/{channel_id}GETFull channel detail (accepts UC…, @handle, or custom URL)
/v1/youtube/channels/{channel_id}/videosGETA channel’s videos
/v1/youtube/channels/{channel_id}/shortsGETA channel’s Shorts
/v1/youtube/channels/{channel_id}/streamsGETA channel’s live streams
/v1/youtube/channels/{channel_id}/playlistsGETA channel’s playlists
/v1/youtube/channels/{channel_id}/communityGETA channel’s community posts
/v1/youtube/channels/{channel_id}/aboutGETLightweight channel about payload
/v1/youtube/channels/{channel_id}/subscriber_countGETFast subscriber-count-only lookup
/v1/youtube/channels/{channel_id}/searchGETSearch within a channel
/v1/youtube/channels/resolveGETResolve a handle / URL to canonical ids

Playlists

EndpointMethodDescription
/v1/youtube/playlists/{playlist_id}GETFull playlist detail + first item page
/v1/youtube/playlists/{playlist_id}/itemsGETA page of playlist items
/v1/youtube/mixes/{mix_id}GETAn auto-generated mix

Community & Reference

EndpointMethodDescription
/v1/youtube/posts/{post_id}GETA community post
/v1/youtube/posts/{post_id}/commentsGETComments on a community post
/v1/youtube/oembedGETPublic oEmbed metadata for a URL
/v1/youtube/categoriesGETVideo category reference list
/v1/youtube/languagesGETSupported UI languages (hl)
/v1/youtube/regionsGETSupported content regions (gl)
/v1/youtube/marketsGETSupported markets reference

Credit Costs

EndpointCost
Search5 credits
Trending / hashtag / home5 credits
Music search5 credits
Video detail10 credits
Batch videos10 credits per video
Related / comments / replies / live chat5 credits
Transcript5 credits
Streams15 credits
Captions2 credits
Short detail / shorts by sound5 credits
Channel detail5 credits
Channel videos / shorts / streams / playlists / community / search5 credits
Channel about / subscriber count / resolve2 credits
Playlist / playlist items / mix5 credits
Community post / post comments5 credits
Autocomplete / oEmbed1 credit
Categories / languages / regions / markets0 credits
Failed requests0 credits

Authentication

All requests require your API key in the X-API-Key header:
curl "https://scrapebadger.com/v1/youtube/videos/dQw4w9WgXcQ" \
  -H "X-API-Key: YOUR_API_KEY"

Anti-Bot Handling

YouTube protects its data with IP-reputation scoring, TLS/HTTP-2 fingerprinting, bot-guard challenges, and PO-token requirements on media. ScrapeBadger clears these automatically using Chrome TLS impersonation on sessions matched to the target region. You never need to manage proxies, sessions, or tokens.
For accurate, localized results, requests are routed through proxies in the gl region. This is handled automatically. Some fields (such as dislike_count and direct media urls) are restricted by YouTube platform-wide and may be null.

Next Steps

Search YouTube

Full API reference for searching videos, channels, and playlists

Get Video Detail

Fetch full metadata for a single video