Skip to content

Instantly share code, notes, and snippets.

@juanpablocs
Last active November 21, 2015 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanpablocs/45eb94d6990e5eba8f05 to your computer and use it in GitHub Desktop.
Save juanpablocs/45eb94d6990e5eba8f05 to your computer and use it in GitHub Desktop.
script que descarga videos de youtube en formato mp3 sin necesidad de FFMPEG
<?php
// instalar youtube-dl en el sistema (linux)
// > sudo curl https://yt-dl.org/downloads/2015.11.19/youtube-dl -o /usr/local/bin/youtube-dl
// > sudo chmod a+rx /usr/local/bin/youtube-dl
// dar permiso 777 a la carpeta destino
// chmod 777 -R tufolder
// eso es todo :)
set_time_limit(0);
$playlist = ['taMbeYE-VIg','Ns9YYSqLxyI'];
foreach($playlist as $pl):
$url = 'https://www.youtube.com/watch?v='.$pl;
$cmd = 'youtube-dl -f 140 -o "/home/tuuser/youtube_download/%(id)s.mp3" ' . escapeshellarg($url);
exec($cmd, $output, $ret);
echo 'output: ';
var_export($output);
echo "\nret: ";
var_export($ret);
endforeach;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment