diff --git a/README.md b/README.md index b0fa6c7..486f16a 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,17 @@ alltube ======= HTML GUI for youtube-dl (http://alltubedownload.net/) + +##Setup +The only thing you need to get Alltube working is to download [youtube-dl](https://rg3.github.io/youtube-dl/): + + wget https://yt-dl.org/downloads/latest/youtube-dl + +##License +This software is available under the [GNU General Public License](http://www.gnu.org/licenses/gpl.html). + +__Please use a different name and logo if you run it on a public server.__ + +##Other dependencies +You need [avconv](https://libav.org/avconv.html) and [rtmpdump](http://rtmpdump.mplayerhq.hu/) in order to enable conversions. +If you don't want to enable conversions, you can disable it in *config.php*. diff --git a/api.php b/api.php index 3b233b1..f0b5b37 100644 --- a/api.php +++ b/api.php @@ -10,10 +10,9 @@ * @license GNU General Public License http://www.gnu.org/licenses/gpl.html * @link http://rudloff.pro * */ -$python="/usr/bin/python"; require_once 'download.php'; if (isset($_GET["url"])) { - if (isset($_GET["format"]) || isset($_GET['audio'])) { + if (isset($_GET['audio'])) { $video = VideoDownload::getJSON($_GET["url"], $_GET["format"]); if (isset($video->url)) { @@ -25,100 +24,40 @@ if (isset($_GET["url"])) { ); $url_info = parse_url($video->url); if ($url_info['scheme'] == 'rtmp') { - if (isset($_GET['audio'])) { - 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). - ' | /usr/bin/avconv -v quiet -i - -f mp3 pipe:1' - ); - exit; - } else { - header( - 'Content-Disposition: attachment; filename="'. - html_entity_decode( + header( + 'Content-Disposition: attachment; filename="'. + html_entity_decode( + pathinfo( VideoDownload::getFilename( - $video->webpage_url, $video->format_id - ), ENT_COMPAT, 'ISO-8859-1' - ).'"' - ); - header("Content-Type: application/octet-stream"); - passthru( - '/usr/bin/rtmpdump -q -r '.escapeshellarg($video->url) - ); - exit; - } - + $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). + ' | /usr/bin/avconv -v quiet -i - -f mp3 pipe:1' + ); + exit; } else { - if (isset($_GET['audio'])) { - 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/wget -q --user-agent='.escapeshellarg($UA). - ' -O - '.escapeshellarg($video->url). - ' | /usr/bin/avconv -v quiet -i - -f mp3 pipe:1' - ); - exit; - } else if (pathinfo($video->url, PATHINFO_EXTENSION) == 'm3u8') { - header( - 'Content-Disposition: attachment; filename="'. - html_entity_decode( - pathinfo( - VideoDownload::getFilename( - $video->webpage_url - ), PATHINFO_FILENAME - ).'.mp4', ENT_COMPAT, 'ISO-8859-1' - ).'"' - ); - header("Content-Type: video/mp4"); - passthru( - '/usr/bin/avconv -v quiet -i '. - escapeshellarg($video->url).' -f h264 pipe:1' - ); - exit; - } else { - $headers = get_headers($video->url, 1); - header( - 'Content-Disposition: attachment; filename="'. - html_entity_decode( + header( + 'Content-Disposition: attachment; filename="'. + html_entity_decode( + pathinfo( VideoDownload::getFilename( - $video->webpage_url, $video->format_id - ), ENT_COMPAT, 'ISO-8859-1' - ).'"' - ); - if (is_string($headers['Content-Type']) - && isset($headers['Content-Type']) - ) { - header("Content-Type: ".$headers['Content-Type']); - } else { - header("Content-Type: application/octet-stream"); - } - if (is_string($headers['Content-Length']) - && isset($headers['Content-Length']) - ) { - header("Content-Length: ".$headers['Content-Length']); - } - readfile($video->url); - exit; - } + $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). + ' | /usr/bin/avconv -v quiet -i - -f mp3 pipe:1' + ); + exit; } } else { $error=true; @@ -129,18 +68,32 @@ if (isset($_GET["url"])) { include 'head.php'; ?> -
+
-

You are going to download - +

You are going to download + . Google Cast™ is disabledGoogle Cast™Casting to ChromeCast…

+ ?>. + Google Cast™ is disabled + Google Cast™ + Casting to ChromeCast…

thumbnail, '" alt="" />'; ?>
@@ -149,28 +102,44 @@ if (isset($_GET["url"])) { formats)) { ?> - Select format -

+

formats)) { + ?> + Download
+ -
diff --git a/config.php b/config.php new file mode 100644 index 0000000..641aa39 --- /dev/null +++ b/config.php @@ -0,0 +1,18 @@ + + * @license GNU General Public License http://www.gnu.org/licenses/gpl.html + * @link http://rudloff.pro + * */ +define('YOUTUBE_DL', './youtube-dl'); +define('PYTHON', '/usr/bin/python'); +define('PARAMS', '--no-playlist --no-warnings'); +define('CONVERT', true); +?> diff --git a/css/style.css b/css/style.css index ff3bb11..4bfdc2a 100644 --- a/css/style.css +++ b/css/style.css @@ -174,10 +174,12 @@ margin-top:8px; font-size:24px; font-weight:800; cursor:pointer; - -webkit-transition: all 0.1s ease-in; - -moz-transition: all 0.1s ease-in; - -o-transition: all 0.1s ease-in; - } + -webkit-transition: all 0.1s ease-in; + -moz-transition: all 0.1s ease-in; + -o-transition: all 0.1s ease-in; + text-decoration:none; + display:inline-block; +} .downloadBtn:focus, .downloadBtn:hover @@ -538,6 +540,14 @@ h1 { vertical-align:middle; } +.format { + text-align:left; +} + +.best { + margin-bottom: 1em; +} + @media (max-width: 640px) { .thumb { width:90%; diff --git a/download.php b/download.php index ab2f177..746c229 100644 --- a/download.php +++ b/download.php @@ -11,7 +11,7 @@ * @license GNU General Public License http://www.gnu.org/licenses/gpl.html * @link http://rudloff.pro * */ - +require_once 'config.php'; /** * PHP web interface for youtube-dl (http://rg3.github.com/youtube-dl/) * Main class @@ -26,9 +26,6 @@ * */ Class VideoDownload { - static private $_python="/usr/bin/python"; - static private $_params="--no-playlist"; - /** * Get version of youtube-dl * @@ -37,7 +34,7 @@ Class VideoDownload function getVersion () { exec( - VideoDownload::$_python.' youtube-dl --version', + PYTHON.' '.YOUTUBE_DL.' --version', $version, $code ); return $version[0]; @@ -50,7 +47,7 @@ Class VideoDownload function getUA () { exec( - VideoDownload::$_python.' youtube-dl --dump-user-agent', + PYTHON.' '.YOUTUBE_DL.' --dump-user-agent', $version, $code ); return $version[0]; @@ -64,7 +61,7 @@ Class VideoDownload function listExtractors () { exec( - VideoDownload::$_python.' youtube-dl --list-extractors', + PYTHON.' '.YOUTUBE_DL.' --list-extractors', $extractors, $code ); return $extractors; @@ -80,7 +77,7 @@ Class VideoDownload * */ function getFilename ($url, $format=null) { - $cmd=VideoDownload::$_python.' youtube-dl'; + $cmd=PYTHON.' youtube-dl'; if (isset($format)) { $cmd .= ' -f '.escapeshellarg($format); } @@ -102,7 +99,7 @@ Class VideoDownload function getTitle ($url) { exec( - VideoDownload::$_python.' youtube-dl --get-title '. + PYTHON.' '.YOUTUBE_DL.' --get-title '. escapeshellarg($url), $title ); @@ -120,11 +117,11 @@ Class VideoDownload * */ function getJSON ($url, $format=null) { - $cmd=VideoDownload::$_python.' youtube-dl '.VideoDownload::$_params; + $cmd=PYTHON.' '.YOUTUBE_DL.' '.PARAMS; if (isset($format)) { $cmd .= ' -f '.escapeshellarg($format); } - $cmd .=' --no-warnings --dump-json '.escapeshellarg($url)." 2>&1"; + $cmd .=' --dump-json '.escapeshellarg($url)." 2>&1"; exec( $cmd, $json, $code @@ -146,7 +143,7 @@ Class VideoDownload function getThumbnail ($url) { exec( - VideoDownload::$_python.' youtube-dl --get-thumbnail '. + PYTHON.' '.YOUTUBE_DL.' --get-thumbnail '. escapeshellarg($url), $thumb ); @@ -165,7 +162,7 @@ Class VideoDownload function getAvailableFormats ($url) { exec( - VideoDownload::$_python.' youtube-dl -F '. + PYTHON.' '.YOUTUBE_DL.' -F '. escapeshellarg($url), $formats ); @@ -195,7 +192,7 @@ Class VideoDownload * */ function getURL ($url, $format=null) { - $cmd=VideoDownload::$_python.' youtube-dl'; + $cmd=PYTHON.' '.YOUTUBE_DL; if (isset($format)) { $cmd .= ' -f '.escapeshellarg($format); } diff --git a/head.php b/head.php index c3803b7..637261b 100644 --- a/head.php +++ b/head.php @@ -9,6 +9,7 @@ href="https://fonts.googleapis.com/css?family=Open+Sans:400,300" /> + AllTube Download diff --git a/img/favicon.png b/img/favicon.png index 75c6d55..217cb72 100644 Binary files a/img/favicon.png and b/img/favicon.png differ diff --git a/img/fondfooter.png b/img/fondfooter.png index c72145e..57f375f 100644 Binary files a/img/fondfooter.png and b/img/fondfooter.png differ diff --git a/img/logo_250.png b/img/logo_250.png new file mode 100644 index 0000000..a83aed0 Binary files /dev/null and b/img/logo_250.png differ diff --git a/img/logo_60.png b/img/logo_60.png index 85800da..338185e 100644 Binary files a/img/logo_60.png and b/img/logo_60.png differ diff --git a/img/logo_90.png b/img/logo_90.png index 2969edd..a6b9a86 100644 Binary files a/img/logo_90.png and b/img/logo_90.png differ diff --git a/img/logo_app.png b/img/logo_app.png index 7d6b48a..7ca733e 100644 Binary files a/img/logo_app.png and b/img/logo_app.png differ diff --git a/img/mp3hover.png b/img/mp3hover.png index 4803885..c79fa6c 100644 Binary files a/img/mp3hover.png and b/img/mp3hover.png differ diff --git a/index.php b/index.php index d7dd5dc..212342d 100644 --- a/index.php +++ b/index.php @@ -19,6 +19,7 @@ require 'head.php';
@@ -35,10 +36,17 @@ require 'head.php'; required placeholder="http://website.com/video" />
-
-

-

-
+ +
+

+

+
+
See all supported websites diff --git a/json.php b/json.php index 36e1617..fd81816 100644 --- a/json.php +++ b/json.php @@ -1,6 +1,16 @@ + * @license GNU General Public License http://www.gnu.org/licenses/gpl.html + * @link http://rudloff.pro + * */ require_once 'download.php'; if (isset($_GET["url"])) { header('Content-Type: application/json'); diff --git a/manifest.webapp b/manifest.webapp index a139719..517c21b 100644 --- a/manifest.webapp +++ b/manifest.webapp @@ -9,7 +9,8 @@ "32": "/img/favicon.png", "60": "/img/logo_60.png", "90": "/img/logo_90.png", - "243": "/img/logo_app.png" + "243": "/img/logo_app.png", + "250": "/img/logo_250.png" }, "default_locale": "en", "launch_path": "/index.php"