YouTube Data API: Videos, Channels, Playlists, Search, Comments avatar

YouTube Data API: Videos, Channels, Playlists, Search, Comments

Pricing

$0.30 / 1,000 results

Go to Apify Store
YouTube Data API: Videos, Channels, Playlists, Search, Comments

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

Omar Nassar

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

0

Monthly active users

14 days ago

Last modified

Features

Limited permissions

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

ModeInputOutput
videosVideo URLs or IDsOne row per video: title, description, tags, views, likes, comment count, duration, definition, captions flag, live-stream times, privacy, license, topics, thumbnail.
channelsChannel URLs, @handles, /user/ URLs or UC... IDsOne row per channel (subscribers, views, video count, country, handle, banner, keywords), then one video row per upload, newest first, with full stats.
playlistsPlaylist URLs or IDsOne row per playlist, then one video row per item in playlist order, with full stats.
searchSearch queriesRanked results with full video, channel or playlist stats. Filters: date range, region, language, video length, order, safe search, channel.
commentsVideo URLs or IDsEvery 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 the UC... 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

  1. Open https://console.cloud.google.com and sign in with a Google account.
  2. Create a project (top bar, Select a project > New project). No billing account is necessary.
  3. Go to APIs & Services > Library, search for YouTube Data API v3, and click Enable.
  4. Go to APIs & Services > Credentials > Create credentials > API key. Copy the key.
  5. 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.
  6. 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.

CallCostGives
Video, channel or playlist details1 unitUp to 50 items
Playlist or uploads page1 unit50 videos
Comment page1 unit100 comments
Search page1 search call50 results
Caption track list50 units1 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
}
FieldModesDescription
apiKeyallYour Google API key. Required.
modeallvideos, channels, playlists, search or comments.
inputsall but searchURLs, IDs or handles. Up to 10,000.
searchQueriessearchOne query per line.
searchTypesearchvideo (default), channel, playlist or all three.
searchOrdersearchrelevance, date, viewCount, rating, title, videoCount.
publishedAfter, publishedBeforesearchDates, e.g. 2026-01-01.
regionCodesearchCountry code, e.g. NL.
relevanceLanguagesearchLanguage code, e.g. nl.
videoDurationsearchany, short (under 4 min), medium (4 to 20 min), long (over 20 min). Videos only.
safeSearchsearchmoderate, none, strict.
searchChannelIdsearchSearch inside one channel.
maxResultsPerQuerysearch1 to 500 (default 50).
includeUploadschannelsReturn the uploads too (default true).
maxVideosPerChannelchannelsDefault 100. 0 means all.
maxItemsPerPlaylistplaylistsDefault 0 (all).
includeCaptionsvideosTry to list caption tracks. See Limits.
commentOrdercommentstime (newest, default) or relevance (top).
includeRepliescommentsReturn all replies (default true).
maxCommentsPerVideocommentsCounts comments and replies. Default 0 (all).
commentSearchTermscommentsOnly top-level comments that contain these words.
concurrencyallInputs 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.list as OAuth-only. With includeCaptions, the actor tries the call once. If Google refuses the API key, the actor stops trying and sets captionsError. The hasCaptions field 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.