YouTube Data API: Videos, Channels, Playlists, Search, Comments
Pricing
$0.30 / 1,000 results
YouTube Data API: Videos, Channels, Playlists, Search, Comments
Video stats, channels with every upload, playlists, filtered search and all comments with replies, through the official YouTube Data API v3 and your own free Google API key. Reports quota used per run. Errors are never charged.
Pricing
$0.30 / 1,000 results
Rating
0.0
(0)
Developer
Omar Nassar
Maintained by CommunityActor stats
0
Bookmarked
1
Total users
0
Monthly active users
14 days ago
Last modified
Categories
Features
Share
Get YouTube data through the official YouTube Data API v3 with your own free Google API key. The actor does not scrape youtube.com and does not use proxies. Google does not change the API shape without notice, so runs do not break when the YouTube website changes.
What you get
| Mode | Input | Output |
|---|---|---|
videos | Video URLs or IDs | One row per video: title, description, tags, views, likes, comment count, duration, definition, captions flag, live-stream times, privacy, license, topics, thumbnail. |
channels | Channel URLs, @handles, /user/ URLs or UC... IDs | One row per channel (subscribers, views, video count, country, handle, banner, keywords), then one video row per upload, newest first, with full stats. |
playlists | Playlist URLs or IDs | One row per playlist, then one video row per item in playlist order, with full stats. |
search | Search queries | Ranked results with full video, channel or playlist stats. Filters: date range, region, language, video length, order, safe search, channel. |
comments | Video URLs or IDs | Every top-level comment and every reply, on all pages. Order: newest or top. Optional word filter. |
Accepted input formats:
- Videos:
youtube.com/watch?v=ID,youtu.be/ID,/shorts/ID,/live/ID,/embed/ID,m.youtube.com, or the 11-character ID. - Channels:
/channel/UC...,/@handle,@handle,/user/name,/c/name, or theUC...ID. A/c/URL has no API lookup; the actor tries it as a handle. - Playlists: any URL with
list=, or the playlist ID.
Duplicates are removed after normalization.
Get a free Google API key in 2 minutes
- Open https://console.cloud.google.com and sign in with a Google account.
- Create a project (top bar, Select a project > New project). No billing account is necessary.
- Go to APIs & Services > Library, search for YouTube Data API v3, and click Enable.
- Go to APIs & Services > Credentials > Create credentials > API key. Copy the key.
- Optional: click the key, set API restrictions to YouTube Data API v3. Do not set website or IP restrictions; Apify runs on changing IP addresses.
- Paste the key into the Your Google API key field. Apify stores it encrypted.
Quota
Google gives each project 10,000 quota units a day for free, plus 100 search calls a day in a separate bucket. Quota resets at midnight Pacific time.
| Call | Cost | Gives |
|---|---|---|
| Video, channel or playlist details | 1 unit | Up to 50 items |
| Playlist or uploads page | 1 unit | 50 videos |
| Comment page | 1 unit | 100 comments |
| Search page | 1 search call | 50 results |
| Caption track list | 50 units | 1 video |
Examples with the free quota: about 250,000 channel uploads with full stats, or about 900,000 comments, or 5,000 search results a day.
Every run writes the quota it used to the SUMMARY record in the key-value store and to the run's status message:
{"mode": "comments","inputs": 2,"results": 159,"errors": 1,"stoppedBy": null,"quota": { "units_used": 4, "search_calls": 0, "api_calls": 4, "default_daily_units": 10000, "default_daily_search_calls": 100 }}
When the quota is used up, the actor stops, keeps all results found so far, and adds one error row that says so. The error row is not charged.
Input example
{"apiKey": "<your Google API key>","mode": "comments","inputs": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ", "https://youtu.be/9bZkp7q19f0"],"commentOrder": "relevance","includeReplies": true,"maxCommentsPerVideo": 0}
Search example:
{"apiKey": "<your Google API key>","mode": "search","searchQueries": ["espresso machine review"],"searchType": "video","searchOrder": "viewCount","publishedAfter": "2026-01-01","regionCode": "NL","relevanceLanguage": "nl","videoDuration": "medium","maxResultsPerQuery": 100}
| Field | Modes | Description |
|---|---|---|
apiKey | all | Your Google API key. Required. |
mode | all | videos, channels, playlists, search or comments. |
inputs | all but search | URLs, IDs or handles. Up to 10,000. |
searchQueries | search | One query per line. |
searchType | search | video (default), channel, playlist or all three. |
searchOrder | search | relevance, date, viewCount, rating, title, videoCount. |
publishedAfter, publishedBefore | search | Dates, e.g. 2026-01-01. |
regionCode | search | Country code, e.g. NL. |
relevanceLanguage | search | Language code, e.g. nl. |
videoDuration | search | any, short (under 4 min), medium (4 to 20 min), long (over 20 min). Videos only. |
safeSearch | search | moderate, none, strict. |
searchChannelId | search | Search inside one channel. |
maxResultsPerQuery | search | 1 to 500 (default 50). |
includeUploads | channels | Return the uploads too (default true). |
maxVideosPerChannel | channels | Default 100. 0 means all. |
maxItemsPerPlaylist | playlists | Default 0 (all). |
includeCaptions | videos | Try to list caption tracks. See Limits. |
commentOrder | comments | time (newest, default) or relevance (top). |
includeReplies | comments | Return all replies (default true). |
maxCommentsPerVideo | comments | Counts comments and replies. Default 0 (all). |
commentSearchTerms | comments | Only top-level comments that contain these words. |
concurrency | all | Inputs in parallel (default 5). |
Output
Each row has type: video, channel, playlist, comment or error. The dataset has three table views: Videos, Channels, Comments. Every row also has input (the input line it came from), error and scrapedAt.
Video row (from the local test run with a mocked API):
{"input": "https://youtu.be/vid00000001","type": "video","videoId": "vid00000001","url": "https://www.youtube.com/watch?v=vid00000001","title": "Video vid00000001","publishedAt": "2026-03-01T12:00:00Z","channelId": "UCaaaaaaaaaaaaaaaaaaaaaa","channelTitle": "Mock Channel","tags": ["mock", "test"],"duration": "PT1H4M13S","durationSeconds": 3853,"definition": "hd","hasCaptions": true,"privacyStatus": "public","viewCount": 123456,"likeCount": 4321,"commentCount": 159,"topicCategories": ["https://en.wikipedia.org/wiki/Technology"],"liveStreaming": null,"error": null}
Comment row:
{"input": "https://www.youtube.com/watch?v=vid00000001","type": "comment","commentId": "Ug0.r0","videoId": "vid00000001","url": "https://www.youtube.com/watch?v=vid00000001&lc=Ug0.r0","isReply": true,"parentId": "Ug0","text": "Comment 900","authorName": "@user900","authorChannelId": "UCxxxxxxxxxxxxxxxxxxx900","likeCount": 4,"replyCount": null,"publishedAt": "2026-03-02T10:00:00Z"}
Channel rows add handle, country, subscriberCount, hiddenSubscriberCount, viewCount, videoCount, uploadsPlaylistId, bannerUrl and keywords. Video rows from a channel or playlist add playlistId, position and sourceChannelId. Search rows add searchQuery and searchRank. Counts that the owner hides (likes, subscribers) are null, not 0.
Error rows: the input does not parse, a video is private or deleted, comments are off, a handle does not exist, or the quota ran out. Error rows are not charged.
Pricing
$0.0003 per result (pay-per-event result). No start fee. Error rows are free. Google does not charge for the API within the free quota.
Limits
- Caption tracks: Google documents
captions.listas OAuth-only. WithincludeCaptions, the actor tries the call once. If Google refuses the API key, the actor stops trying and setscaptionsError. ThehasCaptionsfield on every video row works without OAuth. Caption text cannot be downloaded with an API key. - Search returns at most about 500 results per query, and fewer for some orders and filters.
- The uploads list of a very large channel can stop before the oldest videos; this is a YouTube API limit.
- Subscriber counts are rounded by YouTube to 3 significant figures.
- Comments on videos for kids, and on videos with comments off, are not available.
- The actor stops starting new work when your Max cost per run is reached.
Local test
bash test/mock-test.sh runs all five modes, a quota-exhausted run and a bad-key run against test/mock-server.mjs. The mock server returns responses in the documented API shapes; it is not real YouTube data. The script checks result, error and charge counts, quota units and search parameters, and exits 1 on a mismatch. scripts/test-all.sh needs a real key in test/input.json for this actor.