``Yousef Posted April 12, 2009 Share Posted April 12, 2009 Hey guys. I found this script on the internet, however it doesn't seem to be working for me. Here's the coding <?php if(!empty($_POST)){ $urls = explode("n",$_POST['urls']); foreach($urls as $url){ $file = file_get_contents($url); preg_match("/?v=([^&]+)/",$url,$found); $id = $found[1]; preg_match('/<meta name="title" content="([^"]+)">/',$file,$found); $title = $found[1]; echo "Downloading " . $title . "... <br />n"; exec("youtube-dl ".$url); echo "Converting ". $title. " to audio ... <br />n"; exec('mplayer -dumpaudio '.$id.'.flv -dumpfile "'.$title.'.mp3"'); echo "Cleaning temporary files ... <br />n"; exec('rm '.$id.'.flv'); } } ?> <html> <head> <title>Downloader</title> </head> <body> <form action="<?= $PHP_SELF ?>" method="post"> <table> <tr> <td> List:<br /> <textarea rows="10" cols="40" name="urls"></textarea><br /> <input type="submit" value="Download" /> </td> </tr> </table> <ul><? foreach(glob('*.mp3') as $file) { ?> <li><a href="<?= $file ?>"><?= $file ?></a></li><? } ?> </ul> </form> </body> </html> However, it doesn't seem to be working. There is another file that is meant to be attached. The script above and file can be found at: http://www.protocoder.com/php/create-your-own-youtube-video-to-mp3-converter/ It also says that PHP needs to have the ability to use command line. I'm running on a GoDaddy Linux server, however this doesn't have Python CGI support. I know thats a problem as its required, but is the script itself fine? When I try to run the script I get the error Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 0 in /home/content/p/o/w/powerbutton/html/test.php on line 7 Downloading How To Fix A Xbox 360 E74 And RROD... nConverting How To Fix A Xbox 360 E74 And RROD to audio ... nCleaning temporary files ... n Any help would be great Quote Link to comment https://forums.phpfreaks.com/topic/153784-php-youtube-mp3-script/ Share on other sites More sharing options...
Vince889 Posted April 12, 2009 Share Posted April 12, 2009 I'm not sure, but wouldn't CURL have to be used at some point... ? Quote Link to comment https://forums.phpfreaks.com/topic/153784-php-youtube-mp3-script/#findComment-808225 Share on other sites More sharing options...
``Yousef Posted April 13, 2009 Author Share Posted April 13, 2009 I'm new to this so don't judge me What's CURL? Quote Link to comment https://forums.phpfreaks.com/topic/153784-php-youtube-mp3-script/#findComment-808462 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.