Bulletmig33
Would you like to react to this message? Create an account in a few clicks or log in to continue.

YouTube Video Convert To Mp3 Php Script

Go down

YouTube Video Convert To Mp3 Php Script Empty YouTube Video Convert To Mp3 Php Script

Post  don.1 Sat Nov 17, 2012 5:05 pm

Code:
<?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 $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><?php foreach(glob('*.mp3') as $file) { ?>
      <li><a href="<?php $file; ?>"><?php $file ?></a></li><?php } ?>
        </ul>
      </form>
  </body>
</html>

don.1
don.1
members
members

Posts : 9
Join date : 2011-10-16

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum