Merge branch 'master' into noconv
This commit is contained in:
commit
da08ce51aa
4 changed files with 40 additions and 17 deletions
1
api.php
1
api.php
|
@ -10,7 +10,6 @@
|
||||||
* @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"])) {
|
if (isset($_GET["format"])) {
|
||||||
|
|
17
config.php
Normal file
17
config.php
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?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');
|
||||||
|
?>
|
25
download.php
25
download.php
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
14
json.php
14
json.php
|
@ -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');
|
||||||
|
|
Loading…
Reference in a new issue