我需要使用Quick MP3 API将youtube视频转换为mp3。
http://www.quick-mp3.com/api/v1/docs/
我的代码示例是:
<?php
$url="http://www.youtube.com/watch?v=qpgTC9MDx1o";
// i need to fetch video informations and get mp3 download link
?>
谢谢。
答案 0 :(得分:0)
试试这段代码: 别忘了在php代码中包含quick_func.php
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);
您需要将完整的YouTube视频ID转换为视频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=
享受;)