You are going to download - -{$video->title}. -
-{if isset($video->thumbnail)} --{if isset($video->formats)} - - + {else} + + Download
+ {/if} +
+{/foreach}
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 @@
You are going to download - -{$video->title}. -
-{if isset($video->thumbnail)} -