Convert youtube video to mp3 using Quick MP3 API

Issue

I need convert youtube video to mp3 using Quick MP3 API.

http://www.quick-mp3.com/api/v1/docs/

my code example is :

<?php
$url="http://www.youtube.com/watch?v=qpgTC9MDx1o";
// i need to fetch video informations and get mp3 download link
?>

Thank you.

Solution

try this code :
don’t forgot to include quick_func.php in your php code

require_once('./quick_func.php'); // quick mp3 functions
$url = "http://www.youtube.com/watch?v=qpgTC9MDx1o";
$exp = explode("?v=",$url);
$vid = $exp[1]; 
$data = Convert_Vid($vid); // video id to convert
$id = $data['id']; // get video id
$title = $data['ttl']; // get video title
$duration = $data['duration']; // get video duration
$thumb = $data['thumb']; // get video thumb
$mp3 = $data['mp3']; // get mp3 download link
print_r($data);

you need to transform your full youtube url to video ID :

$url = "http://www.youtube.com/watch?v=qpgTC9MDx1o"; // full youtube url
$exp = explode("?v=",$url); // explode url
$vid = $exp[1]; // get id after ?v=

Enjoy 😉

Answered By – Anass

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published