21.12.2016, 12:41
(
Last edited by SsHady; 21/12/2016 at 01:21 PM.
)
Edit:
Thanks for the response..
Thanks for the response..
https://developers.******.com/youtub...cs/search/list
You need an API key to authorize any request though. Read the documentation to see what you're supposed to extract. I find it more troublesome than just inputting a simple URL link. |
That stuff is complicated... I'd just stay away from it..
Thanks a lot for the quick response, anyways. +2 reputation. |
<?php
set_time_limit(0);
$id = $_GET['id'];
$url = "https://www.youtube.com/watch?v=".$id;
if(!file_exists("files/$id.mp3"))
{
exec("*******-dl --extract-audio --audio-format mp3 $url -o files/$id.mp3");
}
// get title
$info = json_decode(file_get_contents("https://www.*******.com/oembed?format=json&url=".$url), true);
if($info === null)echo "Invalid link?";
else echo $info['title'];
?>