Platforms · YouTube

YouTube Video Files Scraper API

Returns the downloadable video stream files for a YouTube video: each with a direct media url, mime type, resolution (width/height), quality label, fps, bitrate, and approximate duration.

GET /api/v1/data/youtube/video-files · 5 credits per call · Every call fetches the data afresh.

Inputs

  • url (required): Full URL of the YouTube video.

What comes back

  • result_status (string): success, or not_available when the item does not exist, was removed or is not public.
  • items[].approxDurationMs (string): The file's length in milliseconds, as a number in text.
  • items[].audioChannels (integer): How many audio channels the file has.
  • items[].audioQuality (string): YouTube's audio quality name, such as `AUDIO_QUALITY_LOW`.
  • items[].audioSampleRate (string): The audio sample rate in hertz, as a number in text.
  • items[].averageBitrate (number): The average bitrate in bits per second.
  • items[].bitrate (number): The peak bitrate in bits per second.
  • items[].colorInfo (object): The colour space of the picture.
  • items[].colorInfo.matrixCoefficients (string): The colour matrix, such as `COLOR_MATRIX_COEFFICIENTS_BT709`.
  • items[].colorInfo.primaries (string): The colour primaries, such as `COLOR_PRIMARIES_BT709`.
  • items[].colorInfo.transferCharacteristics (string): The colour transfer function, such as `COLOR_TRANSFER_CHARACTERISTICS_BT709`.
  • items[].contentLength (string): The file size in bytes, as a number in text.
  • items[].fps (number): Frames per second.
  • items[].height (integer): The picture height in pixels.
  • items[].indexRange (object): The bytes of the file's index, for streaming.
  • items[].indexRange.end (string): The last byte of the range, as a number in text.
  • items[].indexRange.start (string): The first byte of the range, as a number in text.
  • items[].initRange (object): The bytes of the file's initialisation segment, for streaming.
  • items[].initRange.end (string): The last byte of the range, as a number in text.
  • items[].initRange.start (string): The first byte of the range, as a number in text.
  • items[].itag (integer): YouTube's format code for this file.
  • items[].lastModified (string): When the file was last changed, as microseconds since 1970 in text.
  • items[].lengthSeconds (string): The video's length in seconds, as a number in text.
  • items[].mimeType (string): The file type and codecs, such as `audio/mp4; codecs="mp4a.40.5"`.
  • items[].parsedContentLength (string): The file size in words, such as `1.24 MiB`.
  • items[].parsedLastModified (string): When the file was last changed, as ISO 8601.
  • items[].projectionType (string): How the picture is projected, such as `RECTANGULAR`.
  • items[].quality (string): YouTube's quality name, such as `tiny` or `medium`.
  • items[].qualityLabel (string): The resolution as YouTube labels it, such as `360p`.
  • items[].qualityOrdinal (string): YouTube's quality rank, such as `QUALITY_ORDINAL_360P`.
  • items[].url (string): A direct link to the file. The link expires, so fetch it straight away.
  • items[].width (integer): The picture width in pixels.
  • source_data (object): Everything the platform sent for this call, as it came.

Good to know

  • Each call costs 5 credits. A call that finds nothing, or fails, is free.
  • Every call fetches the data afresh.

Example call

GET /api/v1/data/youtube/video-files?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ

Questions

How much does the YouTube Video Files API cost?

Each call costs 5 credits. A call that finds nothing, or fails, costs nothing.

What do I send?

You must send url. Inputs go in the query string of a GET, or as JSON in a POST, along with your API key.

How fresh is the data?

Every call fetches the data afresh.

Do I need a YouTube account or developer app?

No. You call SocialHz with your SocialHz API key, and the same key works for every platform.

Can I try it before paying?

Yes. Signing up gives you 10 free credits, with no card needed.

Related YouTube endpoints

More YouTube scraper APIs