Convert youtube video to mp3 using Quick MP3 API

4.7k views Asked by At

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.

2

There are 2 answers

0
Anass On BEST ANSWER

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 ;)

0
Salman Zaib On

You should try below API to get mp3 format of any YouTube video as quick-mp3 is no more available.

<iframe id="buttonApi" src="https://convert2mp3s.com/api/button/mp3?url=https://www.youtube.com/watch?v=pRpeEdMmmQ0" width="100%" height="100%" allowtransparency="true" scrolling="no" style="border:none"></iframe>

GitHub Project: https://github.com/matthew-asuncion/Fast-YouTube-to-MP3-Converter-API