diff --git a/api.php b/api.php deleted file mode 100644 index 3c94415..0000000 --- a/api.php +++ /dev/null @@ -1,84 +0,0 @@ - - * @license GNU General Public License http://www.gnu.org/licenses/gpl.html - * @link http://rudloff.pro - * */ -use Alltube\VideoDownload; -require_once 'common.php'; -$smarty->assign('class', 'video'); -if (isset($_GET["url"])) { - if (isset($_GET['audio'])) { - try { - $video = VideoDownload::getJSON($_GET["url"]); - - //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') { - 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; - } - } catch (Exception $e) { - $error = $e->getMessage(); - } - } else { - try { - $video = VideoDownload::getJSON($_GET["url"]); - $smarty->display('head.tpl'); - $smarty->assign('video', $video); - $smarty->display('video.tpl'); - $smarty->display('footer.tpl'); - } catch (Exception $e) { - $error = $e->getMessage(); - } - } -} -if (isset($error)) { - $smarty->display('head.tpl'); - $smarty->assign('errors', $error); - $smarty->display('error.tpl'); - $smarty->display('footer.tpl'); -}