YouTube API

Our YouTube API gives you programmatic access to YouTube data that isn't available through any official API. Get data on video titles, descriptions, view counts, subscriber numbers, comments data, channel information, and more. And the best part? You can try the YouTube API entirely for free, no credit card required.

Trusted by industry leaders all over the world

Integrate our YouTube API

Access the YouTube API using Python, JavaScript, CLI, cURL, OpenAPI, or MCP. Choose your preferred option and start extracting YouTube data in minutes.

Python

Python

JavaScript

JavaScript

HTTP

HTTP

MCP

MCP

1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4# Replace '<YOUR_API_TOKEN>' with your token.
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7# Prepare the Actor input
8run_input = {
9 "searchQueries": ["Crawlee"],
10 "maxResults": 10,
11 "maxResultsShorts": 0,
12 "maxResultStreams": 0,
13}
14
15# Run the Actor and wait for it to finish
16run = client.actor("streamers/youtube-scraper").call(run_input=run_input)
17
18# Fetch and print Actor results from the run's dataset (if there are any)
19print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
20for item in client.dataset(run["defaultDatasetId"]).iterate_items():
21 print(item)
22
23# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

Get data with YouTube API

Extract YouTube data by providing URLs or search terms as input. The YouTube Scraper returns structured JSON data with video titles, descriptions, view counts, subscriber numbers, channel information, comments, subtitles, thumbnails, duration, release dates, and comprehensive metadata.

Input

{
"startUrls": [],
"maxResults": 10,
"searchQueries": [
"Crawlee"
],
"subtitlesFormat": "srt",
"maxResultStreams": 0,
"maxResultsShorts": 0,
"subtitlesLanguage": "any"
}

Output

{
"_fromStrapi": true,
"id": "CwRMBKk8St0",
"url": "<https://www.youtube.com/watch?v=CwRMBKk8St0>",
"date": "5 years ago",
"title": "LET'S ARGUE: Beyoncé Fails the Bechdel Test!",
"duration": "13:48",
"fromYTUrl": "<https://www.youtube.com/results?search_query=bechdel+test>",
"viewCount": 635379,
"channelUrl": "<https://www.youtube.com/@fantano>",
"channelName": "fantano"
}

How to use YouTube API

Sign up for Apify account01

Creating an account is quick and free — no credit card required. Your account gives you access to more than 5,000 scrapers and APIs.

Get started for free
Get your Apify API token02

Go to settings in the Apify console and navigate to the “API & Integrations” tab. There, create a new token and save it for later.

Integrate YouTube API03

Navigate to the YouTube API page and click on the API dropdown menu in the top right corner. In the dropdown menu, you can see API clients, API endpoints, and more.

Open YouTube API
Get your YouTube data via API04

Now, you can use the API and get the data you need from YouTube.

Why use Apify?

Never get blocked

Every plan (free included) comes with Apify Proxy, which is great for avoiding blocking and giving you access to geo-specific content.

Customers love us

We truly care about the satisfaction of our users and thanks to that we're one of the best-rated data extraction platforms on both G2 and Capterra.

Monitor your runs

With our latest monitoring features, you always have immediate access to valuable insights on the status of your web scraping tasks.

Export to various formats

Your datasets can be exported to any format that suits your data workflow, including Excel, CSV, JSON, XML, HTML table, JSONL, and RSS.

Integrate Apify to your workflow

You can integrate your Apify runs with platforms such as Zapier, Make, Keboola, Google Drive, or GitHub. Connect with practically any cloud service or web app.

Large developer community

Apify is built by developers, so you'll be in good hands if you have any technical questions. Our Discord server is always here to help!

Frequently asked questions

While YouTube does provide an official Data API, this scraper goes beyond those limitations to extract additional public data points that the official API doesn't allow access to. Our tool finds comprehensive data in bulk, including metadata and detailed analytics that aren't available through YouTube's standard API endpoints.

Yes, you can try our YouTube Scraper for free. Apify offers free account creation, and the scraper uses a price-per-result model at $5.00 for 1,000 videos ($0.005 per result). You can test the tool with a small dataset to evaluate its performance for your specific use case before committing to larger extractions.

You can extract comprehensive data including video titles, descriptions, view counts, subscriber numbers, comments, channel names, social media links, subtitles, video URLs, channel locations, total videos, duration, release dates, hashtags, thumbnails, number of likes, and detailed channel information. The scraper can handle videos, channels, playlists, shorts, streams, and search results.

Getting started is simple: 1) Create a free Apify account, 2) Open the YouTube Scraper tool, 3) Add YouTube URLs or search terms, 4) Click "Start" to begin extraction, 5) Download your data in JSON, CSV, Excel, or HTML formats. The tool can extract up to 20,000 videos per URL and offers API integration options.

Get started with YouTube API today

Get your first YouTube data in less than 5 minutes. No credit card required. No commitment. Cancel anytime.