if ($url_info['scheme'] == 'rtmp') { header('Content-Disposition: attachment; filename="' . html_entity_decode(pathinfo(VideoDownload::getFilename($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) . ' | ' . AVCONV . ' -v quiet -i - -f mp3 -vn pipe:1'); exit; } else { header('Content-Disposition: attachment; filename="' . html_entity_decode(pathinfo(VideoDownload::getFilename($video->webpage_url), PATHINFO_FILENAME) . '.mp3', ENT_COMPAT, 'ISO-8859-1') . '"'); header("Content-Type: audio/mpeg"); passthru('curl --user-agent ' . escapeshellarg($UA) . ' ' . escapeshellarg($video->url) . ' | ' . AVCONV . ' -v quiet -i - -f mp3 -vn pipe:1'); exit; } } else { $error = true; } } else { $video = VideoDownload::getJSON($_GET["url"]); if (isset($video->webpage_url)) { $smarty->display('head.tpl'); $smarty->assign('video', $video); $smarty->display('video.tpl'); $smarty->display('footer.tpl'); } else { $error = true; } } } if (isset($error)) { $smarty->display('head.tpl'); $smarty->assign('errors', $video['error']); $smarty->display('error.tpl'); $smarty->display('footer.tpl');
<?php /** * PHP web interface for youtube-dl (http://rg3.github.com/youtube-dl/) * List of all supported websites * * PHP Version 5.3.10 * * @category Youtube-dl * @package Youtubedl * @author Pierre Rudloff <*****@*****.**> * @author Olivier Haquette <*****@*****.**> * @license GNU General Public License http://www.gnu.org/licenses/gpl.html * @link http://rudloff.pro * */ require_once 'common.php'; $smarty->assign('class', 'extractors'); require_once 'download.php'; $smarty->display('head.tpl'); $smarty->display('header.tpl'); $smarty->display('logo.tpl'); $smarty->assign('extractors', VideoDownload::listExtractors()); $smarty->display('extractors.tpl'); $smarty->display('footer.tpl');
<?php /** * PHP web interface for youtube-dl (http://rg3.github.com/youtube-dl/) * Redirect to video in best format * * PHP Version 5.3.10 * * @category Youtube-dl * @package Youtubedl * @author Pierre Rudloff <*****@*****.**> * @license GNU General Public License http://www.gnu.org/licenses/gpl.html * @link http://rudloff.pro * */ require_once 'common.php'; require_once 'download.php'; if (isset($_GET["url"])) { $video = VideoDownload::getURL($_GET["url"]); if (isset($video['url'])) { header('Location: ' . $video['url']); } else { echo "Can't find video"; } }
/** * Test getURL function * @return void */ public function testGetURL() { $url = VideoDownload::getURL(self::$_testVideoURL); $this->assertArrayHasKey('success', $url); $this->assertArrayHasKey('url', $url); }