2014-03-13 19:07:56 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* PHP web interface for youtube-dl (http://rg3.github.com/youtube-dl/)
|
2014-04-04 14:38:36 +00:00
|
|
|
*
|
2014-03-13 19:07:56 +00:00
|
|
|
* PHP Version 5.3.10
|
2014-04-04 14:38:36 +00:00
|
|
|
*
|
2014-03-13 19:07:56 +00:00
|
|
|
* @category Youtube-dl
|
|
|
|
* @package Youtubedl
|
2015-01-07 09:47:46 +00:00
|
|
|
* @author Pierre Rudloff <contact@rudloff.pro>
|
2014-03-13 19:07:56 +00:00
|
|
|
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html
|
|
|
|
* @link http://rudloff.pro
|
|
|
|
* */
|
2015-01-07 09:42:44 +00:00
|
|
|
require_once 'common.php';
|
2015-04-11 20:08:24 +00:00
|
|
|
$smarty->assign('class', 'video');
|
2014-03-13 19:07:56 +00:00
|
|
|
require_once 'download.php';
|
|
|
|
if (isset($_GET["url"])) {
|
2015-01-07 09:23:48 +00:00
|
|
|
if (isset($_GET['audio'])) {
|
2015-04-07 18:57:52 +00:00
|
|
|
$video = VideoDownload::getJSON($_GET["url"]);
|
2014-04-04 14:38:36 +00:00
|
|
|
|
2014-03-13 19:07:56 +00:00
|
|
|
if (isset($video->url)) {
|
2015-01-07 09:12:54 +00:00
|
|
|
//Vimeo needs a correct user-agent
|
|
|
|
$UA = VideoDownload::getUA();
|
|
|
|
ini_set(
|
|
|
|
'user_agent',
|
|
|
|
$UA
|
|
|
|
);
|
|
|
|
$url_info = parse_url($video->url);
|
|
|
|
if ($url_info['scheme'] == 'rtmp') {
|
2015-01-07 09:23:48 +00:00
|
|
|
header(
|
|
|
|
'Content-Disposition: attachment; filename="'.
|
|
|
|
html_entity_decode(
|
|
|
|
pathinfo(
|
2015-01-07 09:12:54 +00:00
|
|
|
VideoDownload::getFilename(
|
2015-01-07 09:23:48 +00:00
|
|
|
$video->webpage_url
|
|
|
|
), PATHINFO_FILENAME
|
|
|
|
).'.mp3', ENT_COMPAT, 'ISO-8859-1'
|
|
|
|
).'"'
|
|
|
|
);
|
|
|
|
header("Content-Type: audio/mpeg");
|
|
|
|
passthru(
|
|
|
|
'/usr/bin/rtmpdump -q -r '.escapeshellarg($video->url).
|
2015-05-16 01:23:55 +00:00
|
|
|
' | '.AVCONV.' -v quiet -i - -f mp3 -vn pipe:1'
|
2015-01-07 09:23:48 +00:00
|
|
|
);
|
|
|
|
exit;
|
2015-01-07 09:12:54 +00:00
|
|
|
} else {
|
2015-01-07 09:23:48 +00:00
|
|
|
header(
|
|
|
|
'Content-Disposition: attachment; filename="'.
|
|
|
|
html_entity_decode(
|
|
|
|
pathinfo(
|
2015-01-07 09:12:54 +00:00
|
|
|
VideoDownload::getFilename(
|
2015-01-07 09:23:48 +00:00
|
|
|
$video->webpage_url
|
|
|
|
), PATHINFO_FILENAME
|
|
|
|
).'.mp3', ENT_COMPAT, 'ISO-8859-1'
|
|
|
|
).'"'
|
|
|
|
);
|
|
|
|
header("Content-Type: audio/mpeg");
|
|
|
|
passthru(
|
|
|
|
'/usr/bin/wget -q --user-agent='.escapeshellarg($UA).
|
|
|
|
' -O - '.escapeshellarg($video->url).
|
2015-05-16 01:23:55 +00:00
|
|
|
' | '.AVCONV.' -v quiet -i - -f mp3 -vn pipe:1'
|
2015-01-07 09:23:48 +00:00
|
|
|
);
|
|
|
|
exit;
|
2015-01-07 09:12:54 +00:00
|
|
|
}
|
2014-03-13 19:07:56 +00:00
|
|
|
} else {
|
|
|
|
$error=true;
|
|
|
|
}
|
|
|
|
} else {
|
2014-03-18 14:08:16 +00:00
|
|
|
$video = VideoDownload::getJSON($_GET["url"]);
|
2014-03-13 19:07:56 +00:00
|
|
|
if (isset($video->webpage_url)) {
|
2015-04-11 20:08:24 +00:00
|
|
|
$smarty->display('head.tpl');
|
|
|
|
$smarty->assign('video', $video);
|
|
|
|
$smarty->display('video.tpl');
|
|
|
|
$smarty->display('footer.tpl');
|
2014-03-13 19:07:56 +00:00
|
|
|
} else {
|
|
|
|
$error=true;
|
|
|
|
}
|
|
|
|
}
|
2014-04-04 14:38:36 +00:00
|
|
|
}
|
2014-03-13 19:07:56 +00:00
|
|
|
if (isset($error)) {
|
2015-04-11 20:08:24 +00:00
|
|
|
$smarty->display('head.tpl');
|
|
|
|
$smarty->assign('errors', $video['error']);
|
|
|
|
$smarty->display('error.tpl');
|
|
|
|
$smarty->display('footer.tpl');
|
2014-03-13 19:07:56 +00:00
|
|
|
}
|