Merge branch 'master' into maintenance

This commit is contained in:
Pierre Rudloff 2015-01-07 10:34:36 +01:00
commit 39f81c3674
16 changed files with 162 additions and 134 deletions

View file

@ -2,3 +2,17 @@ alltube
======= =======
HTML GUI for youtube-dl (http://alltubedownload.net/) 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*.

125
api.php
View file

@ -10,10 +10,9 @@
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html * @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro * @link http://rudloff.pro
* */ * */
$python="/usr/bin/python";
require_once 'download.php'; require_once 'download.php';
if (isset($_GET["url"])) { if (isset($_GET["url"])) {
if (isset($_GET["format"]) || isset($_GET['audio'])) { if (isset($_GET['audio'])) {
$video = VideoDownload::getJSON($_GET["url"], $_GET["format"]); $video = VideoDownload::getJSON($_GET["url"], $_GET["format"]);
if (isset($video->url)) { if (isset($video->url)) {
@ -25,7 +24,6 @@ if (isset($_GET["url"])) {
); );
$url_info = parse_url($video->url); $url_info = parse_url($video->url);
if ($url_info['scheme'] == 'rtmp') { if ($url_info['scheme'] == 'rtmp') {
if (isset($_GET['audio'])) {
header( header(
'Content-Disposition: attachment; filename="'. 'Content-Disposition: attachment; filename="'.
html_entity_decode( html_entity_decode(
@ -43,23 +41,6 @@ if (isset($_GET["url"])) {
); );
exit; exit;
} else { } else {
header(
'Content-Disposition: attachment; filename="'.
html_entity_decode(
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;
}
} else {
if (isset($_GET['audio'])) {
header( header(
'Content-Disposition: attachment; filename="'. 'Content-Disposition: attachment; filename="'.
html_entity_decode( html_entity_decode(
@ -77,48 +58,6 @@ if (isset($_GET["url"])) {
' | /usr/bin/avconv -v quiet -i - -f mp3 pipe:1' ' | /usr/bin/avconv -v quiet -i - -f mp3 pipe:1'
); );
exit; 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(
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;
}
} }
} else { } else {
$error=true; $error=true;
@ -129,18 +68,32 @@ if (isset($_GET["url"])) {
include 'head.php'; include 'head.php';
?> ?>
<body> <body>
<div class="wrapper"> <div itemscope
itemtype="http://schema.org/VideoObject" class="wrapper">
<div class="main"> <div class="main">
<?php <?php
include 'logo.php'; include 'logo.php';
?> ?>
<p>You are going to download<i> <p>You are going to download<i itemprop="name">
<a id="video_link" data-ext="<?php echo $video->ext; ?>" data-video="<?php echo $video->url; ?>" href="<?php echo $video->webpage_url; ?>"> <a itemprop="url" id="video_link"
data-ext="<?php echo $video->ext; ?>"
data-video="<?php echo htmlentities($video->url); ?>"
href="<?php echo $video->webpage_url; ?>">
<?php <?php
echo $video->title; echo $video->title;
?></a></i>. <img class="cast_icon" id="cast_disabled" src="img/ic_media_route_disabled_holo_light.png" alt="Google Cast™ is disabled" title="Google Cast is not supported on this browser." /><img class="cast_btn cast_hidden cast_icon" id="cast_btn_launch" src="img/ic_media_route_off_holo_light.png" title="Cast to ChromeCast" alt="Google Cast™" /><img src="img/ic_media_route_on_holo_light.png" alt="Casting to ChromeCast…" title="Stop casting" id="cast_btn_stop" class="cast_btn cast_hidden cast_icon" /></p> ?></a></i>.
<img class="cast_icon" id="cast_disabled"
src="img/ic_media_route_disabled_holo_light.png"
alt="Google Cast™ is disabled"
title="Google Cast is not supported on this browser." />
<img class="cast_btn cast_hidden cast_icon" id="cast_btn_launch"
src="img/ic_media_route_off_holo_light.png"
title="Cast to ChromeCast" alt="Google Cast™" />
<img src="img/ic_media_route_on_holo_light.png"
alt="Casting to ChromeCast…" title="Stop casting"
id="cast_btn_stop" class="cast_btn cast_hidden cast_icon" /></p>
<?php <?php
echo '<img class="thumb" src="', echo '<img itemprop="image" class="thumb" src="',
$video->thumbnail, '" alt="" />'; $video->thumbnail, '" alt="" />';
?><br/> ?><br/>
<form action="api.php"> <form action="api.php">
@ -149,28 +102,44 @@ if (isset($_GET["url"])) {
<?php <?php
if (isset($video->formats)) { if (isset($video->formats)) {
?> ?>
<legend for="format">Select format</legend> <h3>Available formats:</h3>
<select id="format" name="format"> <p>(You might have to do a <i>Right click > Save as</i>)</p>
<ul id="format" class="format">
<?php <?php
echo '<li class="best" itemprop="encoding" itemscope
itemtype="http://schema.org/VideoObject">';
echo '<a download="'.$video->_filename.'" itemprop="contentUrl"
href="', htmlentities($video->url) ,'">';
echo '<b>Best</b> (<span itemprop="encodingFormat">',
$video->ext, '</span>)';
echo '</a></li>';
foreach ($video->formats as $format) { foreach ($video->formats as $format) {
echo '<option value="', $format->format_id, '"'; echo '<li itemprop="encoding"
if ($format->format_id == $video->format_id) { itemscope itemtype="http://schema.org/VideoObject">';
echo ' selected '; echo '<a download="'.str_replace(
} $video->ext, $format->ext, $video->_filename
echo '>'; ).'" itemprop="contentUrl"
echo $format->format, ' (', $format->ext, ')'; href="', htmlentities($format->url) ,'">';
echo '</option>'; echo '<span itemprop="videoQuality">', $format->format,
'</span> (<span itemprop="encodingFormat">',
$format->ext, '</span>)';
echo '</a></li>';
} }
?> ?>
</select><br/><br/> </ul><br/><br/>
<?php <?php
} else { } else {
?> ?>
<input type="hidden" name="format" value="best" /> <input type="hidden" name="format" value="best" />
<?php <?php
} }
if (!isset($video->formats)) {
?>
<a class="downloadBtn"
href="<?php echo $video->url; ?>">Download</a><br/>
<?php
}
?> ?>
<input class="downloadBtn" type="submit" value="Download" /><br/>
</form> </form>
</div> </div>
</div> </div>

18
config.php Normal file
View file

@ -0,0 +1,18 @@
<?php
/**
* PHP web interface for youtube-dl (http://rg3.github.com/youtube-dl/)
* Config file
*
* PHP Version 5.3.10
*
* @category Youtube-dl
* @package Youtubedl
* @author Pierre Rudloff <rudloff@strasweb.fr>
* @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);
?>

View file

@ -177,6 +177,8 @@ margin-top:8px;
-webkit-transition: all 0.1s ease-in; -webkit-transition: all 0.1s ease-in;
-moz-transition: all 0.1s ease-in; -moz-transition: all 0.1s ease-in;
-o-transition: all 0.1s ease-in; -o-transition: all 0.1s ease-in;
text-decoration:none;
display:inline-block;
} }
.downloadBtn:focus, .downloadBtn:focus,
@ -538,6 +540,14 @@ h1 {
vertical-align:middle; vertical-align:middle;
} }
.format {
text-align:left;
}
.best {
margin-bottom: 1em;
}
@media (max-width: 640px) { @media (max-width: 640px) {
.thumb { .thumb {
width:90%; width:90%;

View file

@ -11,7 +11,7 @@
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html * @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro * @link http://rudloff.pro
* */ * */
require_once 'config.php';
/** /**
* PHP web interface for youtube-dl (http://rg3.github.com/youtube-dl/) * PHP web interface for youtube-dl (http://rg3.github.com/youtube-dl/)
* Main class * Main class
@ -26,9 +26,6 @@
* */ * */
Class VideoDownload Class VideoDownload
{ {
static private $_python="/usr/bin/python";
static private $_params="--no-playlist";
/** /**
* Get version of youtube-dl * Get version of youtube-dl
* *
@ -37,7 +34,7 @@ Class VideoDownload
function getVersion () function getVersion ()
{ {
exec( exec(
VideoDownload::$_python.' youtube-dl --version', PYTHON.' '.YOUTUBE_DL.' --version',
$version, $code $version, $code
); );
return $version[0]; return $version[0];
@ -50,7 +47,7 @@ Class VideoDownload
function getUA () function getUA ()
{ {
exec( exec(
VideoDownload::$_python.' youtube-dl --dump-user-agent', PYTHON.' '.YOUTUBE_DL.' --dump-user-agent',
$version, $code $version, $code
); );
return $version[0]; return $version[0];
@ -64,7 +61,7 @@ Class VideoDownload
function listExtractors () function listExtractors ()
{ {
exec( exec(
VideoDownload::$_python.' youtube-dl --list-extractors', PYTHON.' '.YOUTUBE_DL.' --list-extractors',
$extractors, $code $extractors, $code
); );
return $extractors; return $extractors;
@ -80,7 +77,7 @@ Class VideoDownload
* */ * */
function getFilename ($url, $format=null) function getFilename ($url, $format=null)
{ {
$cmd=VideoDownload::$_python.' youtube-dl'; $cmd=PYTHON.' youtube-dl';
if (isset($format)) { if (isset($format)) {
$cmd .= ' -f '.escapeshellarg($format); $cmd .= ' -f '.escapeshellarg($format);
} }
@ -102,7 +99,7 @@ Class VideoDownload
function getTitle ($url) function getTitle ($url)
{ {
exec( exec(
VideoDownload::$_python.' youtube-dl --get-title '. PYTHON.' '.YOUTUBE_DL.' --get-title '.
escapeshellarg($url), escapeshellarg($url),
$title $title
); );
@ -120,11 +117,11 @@ Class VideoDownload
* */ * */
function getJSON ($url, $format=null) function getJSON ($url, $format=null)
{ {
$cmd=VideoDownload::$_python.' youtube-dl '.VideoDownload::$_params; $cmd=PYTHON.' '.YOUTUBE_DL.' '.PARAMS;
if (isset($format)) { if (isset($format)) {
$cmd .= ' -f '.escapeshellarg($format); $cmd .= ' -f '.escapeshellarg($format);
} }
$cmd .=' --no-warnings --dump-json '.escapeshellarg($url)." 2>&1"; $cmd .=' --dump-json '.escapeshellarg($url)." 2>&1";
exec( exec(
$cmd, $cmd,
$json, $code $json, $code
@ -146,7 +143,7 @@ Class VideoDownload
function getThumbnail ($url) function getThumbnail ($url)
{ {
exec( exec(
VideoDownload::$_python.' youtube-dl --get-thumbnail '. PYTHON.' '.YOUTUBE_DL.' --get-thumbnail '.
escapeshellarg($url), escapeshellarg($url),
$thumb $thumb
); );
@ -165,7 +162,7 @@ Class VideoDownload
function getAvailableFormats ($url) function getAvailableFormats ($url)
{ {
exec( exec(
VideoDownload::$_python.' youtube-dl -F '. PYTHON.' '.YOUTUBE_DL.' -F '.
escapeshellarg($url), escapeshellarg($url),
$formats $formats
); );
@ -195,7 +192,7 @@ Class VideoDownload
* */ * */
function getURL ($url, $format=null) function getURL ($url, $format=null)
{ {
$cmd=VideoDownload::$_python.' youtube-dl'; $cmd=PYTHON.' '.YOUTUBE_DL;
if (isset($format)) { if (isset($format)) {
$cmd .= ' -f '.escapeshellarg($format); $cmd .= ' -f '.escapeshellarg($format);
} }

View file

@ -9,6 +9,7 @@
href="https://fonts.googleapis.com/css?family=Open+Sans:400,300" /> href="https://fonts.googleapis.com/css?family=Open+Sans:400,300" />
<link rel="author" href="https://plus.google.com/110403274854419000481?rel=author" /> <link rel="author" href="https://plus.google.com/110403274854419000481?rel=author" />
<link rel="author" href="https://plus.google.com/103696815796116179392?rel=author" /> <link rel="author" href="https://plus.google.com/103696815796116179392?rel=author" />
<link href="https://plus.google.com/108799967445657477255" rel="publisher" />
<title itemprop="name">AllTube Download</title> <title itemprop="name">AllTube Download</title>
<meta itemprop="url" content="http://alltubedownload.net/" /> <meta itemprop="url" content="http://alltubedownload.net/" />
<link rel="icon" href="img/favicon.png" /> <link rel="icon" href="img/favicon.png" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

BIN
img/logo_250.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 731 B

After

Width:  |  Height:  |  Size: 730 B

Before After
Before After

View file

@ -19,6 +19,7 @@ require 'head.php';
<?php <?php
require 'header.php'; require 'header.php';
require 'config.php';
?> ?>
<div class="wrapper"> <div class="wrapper">
@ -35,10 +36,17 @@ require 'head.php';
required placeholder="http://website.com/video" /> required placeholder="http://website.com/video" />
</span> </span>
<input class="downloadBtn" type="submit" value="Download" /><br/> <input class="downloadBtn" type="submit" value="Download" /><br/>
<?php
if (CONVERT) {
?>
<div class="mp3"> <div class="mp3">
<p><input type="checkbox" id="audio" class="audio" name="audio"> <p><input type="checkbox" id="audio" class="audio" name="audio">
<label for="audio"><span class="ui"></span>Audio only (MP3)</label></p> <label for="audio"><span class="ui"></span>
Audio only (MP3)</label></p>
</div> </div>
<?php
}
?>
</div> </div>
</form> </form>
<a class="combatiblelink" href="extractors.php">See all supported websites</a> <a class="combatiblelink" href="extractors.php">See all supported websites</a>

View file

@ -1,6 +1,16 @@
<?php <?php
/**
$python="/usr/bin/python"; * PHP web interface for youtube-dl (http://rg3.github.com/youtube-dl/)
* JSON API
*
* PHP Version 5.3.10
*
* @category Youtube-dl
* @package Youtubedl
* @author Pierre Rudloff <rudloff@strasweb.fr>
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro
* */
require_once 'download.php'; require_once 'download.php';
if (isset($_GET["url"])) { if (isset($_GET["url"])) {
header('Content-Type: application/json'); header('Content-Type: application/json');

View file

@ -9,7 +9,8 @@
"32": "/img/favicon.png", "32": "/img/favicon.png",
"60": "/img/logo_60.png", "60": "/img/logo_60.png",
"90": "/img/logo_90.png", "90": "/img/logo_90.png",
"243": "/img/logo_app.png" "243": "/img/logo_app.png",
"250": "/img/logo_250.png"
}, },
"default_locale": "en", "default_locale": "en",
"launch_path": "/index.php" "launch_path": "/index.php"