Download video and music using cURL

Using our API to download YouTube video, SoundCloud music, Facebook media, etc. For FREE!

Code Example

cURL


Our API is really easy to use to download media files! Check this example out. How to download a YouTube video with cURL:

curl --get --include 'https://getvideo.p.mashape.com/?url=PAGE-URL-TO-GET' \
  -H 'X-Mashape-Key: YOUR-API-KEY' \
  -H 'Accept: text/plain'

This will return a JSON array with download links, thumbnails, etc!

For example, let’s say you want to download the Taylor Swift music video Shake It Off, from YouTube. First, locate the URL to the video in question, in this case it’s “https://www.youtube.com/watch?v=nfWlot6h_JM”.

Then, just use that URL (with URL encoding), and your Mashape API key, as above. If you don’t have an API key yet, click here to get started.

So, your code should look something like this:

curl --get --include 'https://getvideo.p.mashape.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DnfWlot6h_JM' \
  -H 'X-Mashape-Key: YOUR-API-KEY' \
  -H 'Accept: text/plain'

You will get a JSON array back as a result:

 {
   "status":true,
   "message":"Successfully received info.",
   "site":"Youtube",
   "title":"Taylor Swift - Shake It Off", 
   "like_count":6290433,
   "dislike_count":744939,
   "view_count":2234478374,
   "duration":242,
   "upload_date":"20140818",
   "description":"Taylor\u2019s new release 1989 is Available Now featuring the hit single \u201cShake It Off\u201d and her latest single \u201cBlank Space\u201d. ",
   "tags":[
      "Taylor",
      "Swift",
      "Shake",
      "It",
      "Off",
      "Big",
      "Machine",
      "Records"],
   "uploader":"TaylorSwiftVEVO",
   "uploader_url":"http:\/\/www.youtube.com\/user\/TaylorSwiftVEVO",
   "thumbnail":"https:\/\/i.ytimg.com\/vi\/nfWlot6h_JM\/maxresdefault.jpg",
   "streams":[
   {
      "url":"https:\/\/r6---sn-4g57knkz.googlevideo.com\/videoplayback?id=9d[...]",
      "format":"audio only (DASH audio)",
      "format_note":"Audio only, no video",
      "extension":"m4a",
      "video_codec":"none",
      "audio_codec":"mp4a.40.5",
      "filesize":1438229,
      "height":null,
      "width":null
   },
   {
      "url":"https:\/\/r6---sn-4g57knkz.googlevideo.com\/videoplayback?key=[...]",
      "format":"1920x1080 (1080p)",
      "format_note":"1080p",
      "extension":"webm",
      "video_codec":"vp9",
      "audio_codec":"none",
      "filesize":68016821,
      "height":1080,
      "width":1920
   },
  {
      ...
   }

In the array, you have “status” and “message” to give you the results, a thumbnail, and the most important parts, the “streams” array!

The “streams” array will contain all variants of the video, with or without audio, and in different quality!

Just pick the URL you want to download, and off you go!

Developers are downloading 50,000+ videos daily with our API. For FREE!