Skip to main content

Setup

Put them in your environment or .env; Data APIs covers the other ways.

Notes

  • Only public data, read with an API key. Data private to a user, and every upload, comment, rating or other change, needs OAuth 2.0 and is not covered here.
  • Quota is in units, default 10,000 a day per project: most reads cost 1, and search is also capped at 100 calls a day by default.
  • Lists page with nextPageToken and pageToken; maxResults tops out at 50 (100 for comment threads).
  • part is required on every list call and decides which fields come back.

Endpoints

Get videos by id or most-popular chart

  • maxResults and pageToken work with chart, not with id (up to 50 ids per call).
  • Each call costs 1 quota unit; the default quota is 10,000 units a day.
  • Quota: the default 10,000 units a day applies, but search calls are also capped at 100 per day under default quota. Use videos.get or channels.get when you already have ids.
  • Returns ids and snippets only, no statistics: follow up with videos.get.

Get channels by id, handle or username

  • contentDetails.relatedPlaylists.uploads is the playlist of a channel’s uploads: list it with playlist_items.list.

List the videos of a playlist

List playlists

List comment threads of a video or channel

  • Videos with comments disabled answer 403 commentsDisabled.
  • replies in the answer holds only some replies; fetch the rest with the comments list endpoint by parentId.