You can scrape YouTube three ways in 2026: the official YouTube Data API, yt-dlp, or a Python library built for transcripts. Each one works on a laptop. Trouble starts at volume or on a server, where YouTube answers with HTTP 429 errors or "Sign in to confirm you're not a bot". Below: how to scrape YouTube data with each method, what every block message means, and the proxy setup that keeps a YouTube scraper running.
Key takeaways
- The YouTube Data API is the sanctioned route: 10,000 units a day for most reads, plus a separate bucket of 100 search calls a day since June 2026.
- yt-dlp scrapes video metadata, channel lists, search results, comments and transcripts without an API key, and in 2026 it needs a JavaScript runtime such as Deno for full YouTube support.
- HTTP 429 means one IP sent too many requests. "Sign in to confirm you're not a bot" usually means YouTube distrusts the IP itself, which is why scrapers on cloud servers get blocked first.
- Pace requests with yt-dlp's sleep preset and spread videos across IPs, keeping each video on one IP from metadata to the last byte.
- YouTube blocks datacenter IPs first. Mobile carrier IPv4 addresses, shared by many real users on the same network, hold up best for heavy yt-dlp and transcript runs.
Which Method Fits the YouTube Data You Need
Start with the data you need, because each method covers a different slice of YouTube:
| Data | Best method | Proxy needed? |
|---|---|---|
| Video metadata (title, views, likes, length) | Data API videos.list, or yt-dlp | Not for the API. For yt-dlp, at volume or from a server |
| Every video on a channel | yt-dlp with --flat-playlist, or the API's playlistItems.list | Same as above |
| Search results | yt-dlp ytsearch, since the API allows 100 searches a day | At volume |
| Comments | yt-dlp --write-comments, or the API's commentThreads.list | At volume |
| Transcripts | yt-dlp --write-auto-subs, or youtube-transcript-api | Yes from cloud servers |
Method 1: The YouTube Data API
Google's YouTube Data API is the official way to scrape YouTube data, and it needs a free API key from a Google Cloud project instead of a proxy. Limits are set per project, not per IP. According to Google's YouTube Data API overview, updated November 2026, a project gets 10,000 units a day for most endpoints, plus its own bucket of 100 search.list calls a day, a split Google introduced in June 2026.
Reads such as videos.list, channels.list, playlistItems.list and commentThreads.list cost 1 unit each, while captions.list costs 50. That covers thousands of video, channel and comment lookups a day. Search is the tight limit: 100 calls a day is enough to sample a topic, not to scrape YouTube search results at scale. When you need more searches, more comments than the quota allows, or transcripts, yt-dlp takes over.
Method 2: yt-dlp for Videos, Channels, Comments and Transcripts
yt-dlp is the open-source tool most custom YouTube setups are built on, and it pulls data without an API key. Since late 2025 it needs an external JavaScript runtime to solve YouTube's JavaScript challenges. Its EJS wiki recommends Deno, which is enabled by default, and installing yt-dlp with its default dependency group so the challenge scripts come along.
Here is how to scrape YouTube videos, channels, search results, comments and transcripts with one tool:
1# Install yt-dlp with the challenge scripts2pip install -U "yt-dlp[default]"3 4# Install Deno, the JavaScript runtime yt-dlp uses for YouTube's challenges5curl -fsSL https://deno.land/install.sh | sh6 7# Video metadata as JSON, without downloading the video8yt-dlp --skip-download -J "https://www.youtube.com/watch?v=VIDEO_ID" > video.json9 10# Every video on a channel as a flat list11yt-dlp --flat-playlist -J "https://www.youtube.com/@CHANNEL/videos" > channel.json12 13# The top 50 search results for a query14yt-dlp --flat-playlist -J "ytsearch50:mobile proxies" > search.json15 16# Comments, saved inside VIDEO_ID.info.json17yt-dlp --skip-download --write-info-json --write-comments -o "%(id)s.%(ext)s" "https://www.youtube.com/watch?v=VIDEO_ID"18 19# English auto-generated transcripts for a whole channel, paced20yt-dlp -t sleep --skip-download --write-auto-subs --sub-langs en "https://www.youtube.com/@CHANNEL/videos"Those five commands cover the usual jobs. For comments alone, --write-comments is the shortest route, and the max_comments extractor argument caps how much you pull from large videos: --extractor-args "youtube:max_comments=1000,all,100" takes at most 1,000 comments and 100 replies in total. Once you scale, the -t sleep preset in the last command matters more than any other flag, as the rate limit section below shows.
Method 3: Python for Transcripts and Comments
In Python, two routes cover most jobs: the youtube-transcript-api library for transcripts, and yt-dlp's Python interface for everything else. If you are new to Python scraping, our Python web scraping tutorial covers the basics first.
According to the youtube-transcript-api README, YouTube has started blocking most IPs that belong to cloud providers such as AWS, Google Cloud and Azure, so a YouTube transcript scraper that works on a laptop often fails once deployed. A proxy goes in through the library's GenericProxyConfig class:
1from youtube_transcript_api import YouTubeTranscriptApi2from youtube_transcript_api.proxies import GenericProxyConfig3 4proxy = "http://<list-username>:<list-password>@proxy.voidmob.com:10000"5 6ytt_api = YouTubeTranscriptApi(7 proxy_config=GenericProxyConfig(http_url=proxy, https_url=proxy)8)9 10transcript = ytt_api.fetch("VIDEO_ID")11for snippet in transcript:12 print(round(snippet.start, 1), snippet.text)Its README also notes that a proxy doesn't guarantee you won't be blocked, which is why the IP type and the request pace below decide whether a scraper survives.
Common YouTube Scraping Jobs
Three jobs come up in almost every YouTube project: search results, full channels and comment exports. Each has a lighter and a heavier way to run it.
Scrape YouTube Search Results
A ytsearch50: query returns the top results but can't sort or filter them. For sorted or filtered results, run the search in a browser, set the filters, and pass the full results URL to yt-dlp, which supports YouTube search URLs with sorting and filters:
1# First 100 results for a filtered search, copied from the browser address bar2yt-dlp --flat-playlist -I 1:100 -J "https://www.youtube.com/results?search_query=mobile+proxies&sp=<filter-from-browser>" > search.jsonWith --flat-playlist, each result comes back with its video ID, title, channel, duration and view count without opening every video, which keeps the request count, and the block risk, low. Run a full extraction only on the videos you actually need.
Build a YouTube Channel Scraper
A channel keeps videos, Shorts and live streams on separate tabs, and yt-dlp reads each one as its own list:
1for tab in videos shorts streams; do2yt-dlp --flat-playlist -J "https://www.youtube.com/@CHANNEL/$tab" > "$tab.json"3doneFor subscriber counts and channel descriptions across many channels, the Data API's channels.list returns them for 1 unit per call, which is cheaper on IP reputation than scraping each channel page.
Turn Scraped YouTube Comments Into a CSV
Comments land in the .info.json file as a list. Each entry has an id, a parent (root for top-level comments), the text, the author, a like count and a timestamp, and a few lines of Python turn that list into a spreadsheet:
1import csv2import json3import sys4 5info = json.load(open(sys.argv[1], encoding="utf-8"))6fields = ["id", "parent", "author", "text", "like_count", "timestamp"]7 8with open(info["id"] + "_comments.csv", "w", newline="", encoding="utf-8") as f:9 writer = csv.DictWriter(f, fieldnames=fields, extrasaction="ignore")10 writer.writeheader()11 writer.writerows(info.get("comments") or [])Run it as python comments_to_csv.py VIDEO_ID.info.json. Comment timestamps are estimates, since YouTube only shows relative dates such as "2 weeks ago". Comments also carry usernames, so store only the fields you need.
Why YouTube Blocks Scrapers: 429 and "Sign In to Confirm You're Not a Bot"
YouTube uses several block messages, and each points to a different cause:
| What you see | What it means | Fix |
|---|---|---|
| HTTP Error 429: Too Many Requests | One IP sent too many requests in a short window | Slow down with -t sleep and spread videos across IPs |
| Sign in to confirm you're not a bot | YouTube distrusts the IP, often a datacenter, VPN or overused address | Run from a carrier or residential IP rather than a datacenter or VPN address. Cookies work too, but tie the scraper to an account |
| RequestBlocked or IpBlocked (youtube-transcript-api) | The IP belongs to a cloud provider or made too many requests | Route transcripts through a rotating proxy |
| Missing formats or JavaScript challenge warnings | yt-dlp has no JavaScript runtime | Install Deno and yt-dlp[default] |
| HTTP Error 403: Forbidden on download | An outdated yt-dlp, a PO token problem, or a session that changed IP mid-video | Update yt-dlp and keep each video on one IP |
On yt-dlp's issue tracker, a contributor's reply to the sign-in error is that the IP was blocked for abusive behavior, and the fix is another IP or cookies. Logged-in cookies can clear the check, but every request then runs on that account, and a restricted account takes the scraper down with it.
How to Stay Under YouTube Rate Limits
To stay under YouTube's rate limits, lower the number of requests each IP makes rather than retrying faster. Four habits do most of the work:
- Pace every run. yt-dlp's
-t sleeppreset expands to--sleep-subtitles 5 --sleep-requests 0.75 --sleep-interval 10 --max-sleep-interval 20, which slows extraction to a human-looking rhythm. - Use the API where it covers you. Metadata and comments through the Data API cost quota, not IP reputation.
- Skip what you already have. Keep the .info.json files and only fetch videos you haven't scraped.
- Spread videos across IPs, one IP per video. yt-dlp fetches a video's metadata, formats and subtitles in separate requests, so a proxy that rotates per request can split one video across several IPs, which looks nothing like a viewer and can fail mid-download. Rotate between videos, never inside one.
In practice, that means giving each worker its own proxy list set to Sticky (lists rotate per request by default) and cycling through them video by video:
1import itertools2import os3import yt_dlp4 5# One sticky proxy per line: <list-username>:<list-password>@proxy.voidmob.com:100006proxies = [line.strip() for line in open("proxies.txt") if line.strip()]7video_ids = [line.strip() for line in open("video_ids.txt") if line.strip()]8 9for video_id, proxy in zip(video_ids, itertools.cycle(proxies)):10 if os.path.exists(f"data/{video_id}.info.json"):11 continue12 opts = {13 "proxy": "http://" + proxy,14 "skip_download": True,15 "writeinfojson": True,16 "getcomments": True,17 "writeautomaticsub": True,18 "subtitleslangs": ["en"],19 "sleep_interval_requests": 0.75,20 "sleep_interval_subtitles": 5,21 "ignoreerrors": True,22 "outtmpl": {"default": "data/%(id)s.%(ext)s"},23 }24 with yt_dlp.YoutubeDL(opts) as ydl:25 ydl.download(["https://www.youtube.com/watch?v=" + video_id])Best Proxies for YouTube Scraping
The best proxies for YouTube scraping are the ones YouTube already sees real viewers on, and carrier IPv4 addresses are shared across many subscribers. Here is how the three types compare for this job, and our comparison of mobile proxies for web scraping covers providers in more depth:
| Datacenter | Residential | Mobile | |
|---|---|---|---|
| IP source | Server and cloud ranges | Home ISP connections | 4G and 5G carrier networks |
| How YouTube treats it | The first IPs it blocks | Trusted until the pool is overused | Shared IPv4 addresses behind carrier NAT, so blocking one hits real viewers too |
| Fits | Light jobs that already work from your server | Rotating metadata and transcript pulls | Heavy yt-dlp runs and transcripts from servers |
VoidMob mobile proxies for YouTube run on real carrier IPs. One package holds up to 100 proxy lists, each with its own credentials, country targeting and rotation setting: per request for flat search and channel listings, sticky for the one-IP-per-video pattern above, or timed. Every list takes HTTP and SOCKS5 on the same host and port, so yt-dlp's --proxy accepts either scheme. If you'd rather control rotation yourself, a dedicated mobile device keeps one IP until you rotate it from the dashboard, a private rotation link or the API between batches.
Metadata, comments and transcripts use little data. Estimate your monthly usage before picking a shared plan:
Proxy data usage calculator
Rough estimate, not a billing forecast. Real usage varies by target, media mix and caching.
About 60 MB per hour per account, over 30 days.
Prices updated
Do You Need a YouTube Account to Scrape?
Most public YouTube data scrapes without signing in, and logged-out scraping keeps your accounts out of the picture. An account only comes in for age-restricted or members-only videos, or when a bot check on your IP asks you to sign in.
If you use one, keep it separate from your personal Google account, since any restriction lands on it. Google can ask new accounts for a phone number, and a non-VoIP rental or dedicated number keeps that account's verification on a carrier line you can receive codes on again.
Before You Scale a YouTube Scraper
Check four things first:
- the Data API covers whatever it can within its daily quota
- yt-dlp is current and has Deno for YouTube's JavaScript challenges
- every run uses the
-t sleepdelays or slower - each video stays on one IP, with videos spread across sticky proxies
Scrape YouTube on real carrier IPs
Mobile proxies on 4G and 5G carrier networks, with sticky or rotating sessions for yt-dlp and transcript scrapers.
FAQ
Is it legal to scrape data from YouTube?
This isn't legal advice. YouTube's Terms of Service bar accessing the service by automated means such as scrapers, except for public search engines following robots.txt or with YouTube's prior written permission, and bar collecting information that might identify a person. The Data API is the sanctioned route. Comments carry usernames, so privacy law can apply to what you store. Check the rules where you operate before scraping at scale.
How do I scrape YouTube comments?
Run yt-dlp with --skip-download, --write-info-json and --write-comments on a video URL, and the comments land in the .info.json file. With the Data API, commentThreads.list returns comment threads for 1 quota unit per call. Pace the run and spread it across IPs when you scrape many videos.
How do I fix YouTube 429 Too Many Requests?
A 429 means one IP sent too many requests too fast. Slow yt-dlp down with the -t sleep preset, stop re-fetching videos you already have, move what you can to the Data API, and spread the remaining videos across several sticky proxies, one IP per video.
Can you scrape YouTube transcripts from a server?
Yes, but the youtube-transcript-api project warns that YouTube blocks most cloud-provider IPs. Route transcript requests through a rotating residential or mobile proxy with the library's GenericProxyConfig, or use yt-dlp's --write-auto-subs with --skip-download behind the same proxy.
What are the best proxies for YouTube scraping?
YouTube blocks datacenter IPs first. Residential proxies work for rotating metadata and transcript pulls, and mobile proxies on carrier IPs hold up best for heavy yt-dlp runs because each IPv4 address is shared with many real users. Use sticky sessions so each video stays on one IP.
Can the YouTube Data API download transcripts?
Only for videos you can edit. The API's captions.download method requires permission to edit the video, so transcripts for other people's videos come from yt-dlp's --write-auto-subs or the youtube-transcript-api library instead. Run both behind a proxy when they run on a server.
