From 03cf5061328e4714f7c640250bb45685f08da4a2 Mon Sep 17 00:00:00 2001 From: Uli Koeth Date: Tue, 7 Mar 2017 17:24:34 +0100 Subject: [PATCH] Handle download lists part 1 --- classes/VideoDownload.php | 9 ++- index.php | 1 - templates/video.tpl | 160 +++++++++++++++++++------------------- 3 files changed, 89 insertions(+), 81 deletions(-) diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php index 345d2eb..8391c7a 100644 --- a/classes/VideoDownload.php +++ b/classes/VideoDownload.php @@ -113,7 +113,14 @@ class VideoDownload * */ public function getJSON($url, $format = null, $password = null) { - return json_decode($this->getProp($url, $format, 'dump-json', $password)); + $jsonArray = preg_split( "/\r|\n/", $this->getProp($url, $format, 'dump-json', $password), -1, + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + $decodedJson = array(); + foreach ($jsonArray as $oneJson) + { + array_push($decodedJson, json_decode($oneJson)); + } + return $decodedJson; } /** diff --git a/index.php b/index.php index b3b77de..ce07549 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,4 @@
{include file="inc/logo.tpl"} -

You are going to download - . -

-{if isset($video->thumbnail)} - -{/if} -{if isset($video->description)} - -{/if} -{if isset($video->upload_date)} - -{/if} -
-{if isset($video->formats)} -

-
- - {if uglyUrls} - - {/if} - + {if uglyUrls} + + {/if} +

-
-
-{else} - - Download
-{/if} + + + + + {foreach $video->formats as $format} + {if $config->stream || $format->protocol|in_array:array('http', 'https')} + {strip} + + {/strip} + {/if} + {/foreach} + +

+
+ + {else} + + Download
+ {/if} +
+{/foreach}
{include file="inc/footer.tpl"}