Display error message (fixes #1)
This commit is contained in:
parent
0651377e93
commit
efcf786b44
2 changed files with 9 additions and 5 deletions
4
api.php
4
api.php
|
@ -14,7 +14,7 @@ $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["format"]) || isset($_GET['audio'])) {
|
||||||
$video = json_decode(VideoDownload::getJSON($_GET["url"], $_GET["format"]));
|
$video = VideoDownload::getJSON($_GET["url"], $_GET["format"]);
|
||||||
|
|
||||||
if (isset($video->url)) {
|
if (isset($video->url)) {
|
||||||
//Vimeo needs a correct user-agent
|
//Vimeo needs a correct user-agent
|
||||||
|
@ -124,7 +124,7 @@ if (isset($_GET["url"])) {
|
||||||
$error=true;
|
$error=true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$video = json_decode(VideoDownload::getJSON($_GET["url"]));
|
$video = VideoDownload::getJSON($_GET["url"]);
|
||||||
if (isset($video->webpage_url)) {
|
if (isset($video->webpage_url)) {
|
||||||
include 'head.php';
|
include 'head.php';
|
||||||
?>
|
?>
|
||||||
|
|
10
download.php
10
download.php
|
@ -124,12 +124,16 @@ Class VideoDownload
|
||||||
if (isset($format)) {
|
if (isset($format)) {
|
||||||
$cmd .= ' -f '.escapeshellarg($format);
|
$cmd .= ' -f '.escapeshellarg($format);
|
||||||
}
|
}
|
||||||
$cmd .=' --dump-json '.escapeshellarg($url);
|
$cmd .=' --dump-json '.escapeshellarg($url)." 2>&1";
|
||||||
exec(
|
exec(
|
||||||
$cmd,
|
$cmd,
|
||||||
$json
|
$json, $code
|
||||||
);
|
);
|
||||||
return $json[0];
|
if ($code>0) {
|
||||||
|
return array('success'=>false, 'error'=>$json);
|
||||||
|
} else {
|
||||||
|
return json_decode($json[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue