DEV Community

Cover image for Youtube Video API
Ayush Singh
Ayush Singh

Posted on

Youtube Video API

I have just published a Youtube Video Downloader API on rapid api

Using this simple and easy to use API you can convert any youtube video to

  1. MP4
  2. MP3
  3. M4A
  4. WebM

In the JSON output you get links to these formats and qualities.

  1. video with audio [3gp, 144p, 360p, 720p]
  2. video without audio [144p, 240p, 360p, 480p, 720p, 1080p]
  3. audio in the YouTube video [48kbps, 64kbps, 128kbps]

You can use this api anything you want and in any place you want. I have also allowed 1,000 calls free every single month which is great considering you get to convert 1,000 youtube videos in all these formats every single month.

To print the json output in php just use the code below.


$homepage = "contains_json_output";
$json = json_decode($homepage);
echo 'url - '.$json->url.'<br>';
echo 'title - '.$json->title.'<br>';
echo 'thumbnail - '.$json->thumbnail.'<br>';
echo 'duration - '.$json->duration.'<br>';
echo 'source - '.$json->source.'<br>';

$length = 22;
for ($i = 0; $i < $length; $i++) {
    echo '<br><br>--------<br><br>';
echo 'url - <a href="'.$json->medias[$i]->url.'">'.$json->medias[$i]->extension.'</a><br>';
echo 'quality - '.$json->medias[$i]->quality.'<br>';
echo 'extension - '.$json->medias[$i]->extension.'<br>';
echo 'size - '.$json->medias[$i]->size.'<br>';
echo 'formattedSize - '.$json->medias[$i]->formattedSize.'<br>';
$bool = $json->medias[$i]->videoAvailable;
echo 'videoAvailable - '.(boolval($bool) ? 'true' : 'false').'<br>';
echo 'audioAvailable - '.(boolval($json->medias[$i]->audioAvailable) ? 'true' : 'false').'<br>';
echo 'chunked - '.(boolval($json->medias[$i]->chunked) ? 'true' : 'false').'<br>';
echo 'cached - '.(boolval($json->medias[$i]->cached) ? 'true' : 'false').'<br>';

echo '<br><br>--------<br><br>';
Enter fullscreen mode Exit fullscreen mode

Discussion (6)

ayush_singh_dev profile image
Ayush Singh Author

I am not sharing it publicly due to legal issues if you want to get the API yourself. We can talk this through on skype - live:.cid.53f84e9251b69f29

mohsinali1065 profile image
Mohsin Shoukat

Page not Found

ayush_singh_dev profile image
Ayush Singh Author

Due to fear legal issue i removed the API. Just tell me the amount of calls you want and let's do a custom deal here.

camco profile image

Excellent! I love rapid API

andrewbaisden profile image
Andrew Baisden

Wow this is so good.