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 7e8dcdc..f773d2c 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/controllers/FrontController.php b/controllers/FrontController.php
index 98d6937..4fb6548 100644
--- a/controllers/FrontController.php
+++ b/controllers/FrontController.php
@@ -213,7 +213,7 @@ class FrontController
private function getVideoResponse(Request $request, Response $response, array $params, $password = null)
{
try {
- $video = $this->download->getJSON($params['url'], $this->defaultFormat, $password);
+ $vidarr = $this->download->getJSON($params['url'], $this->defaultFormat, $password);
} catch (PasswordException $e) {
return $this->password($request, $response);
}
@@ -226,10 +226,10 @@ class FrontController
$response,
'video.tpl',
[
- 'video' => $video,
+ 'vidarr' => $vidarr,
'class' => 'video',
- 'title' => $video->title,
- 'description' => 'Download "'.$video->title.'" from '.$video->extractor_key,
+ 'title' => $vidarr[0]->title,
+ 'description' => 'Download "'.$vidarr[0]->title.'" from '.$vidarr[0]->extractor_key,
'protocol' => $protocol,
'config' => $this->config,
'canonical' => $this->getCanonicalUrl($request),
diff --git a/index.php b/index.php
index b3b77de..ce07549 100644
--- a/index.php
+++ b/index.php
@@ -1,5 +1,4 @@
0) {
+ var i;
+ for (i = 0; i < launchBtn.length; i++) {
+ disabledBtn[i].classList.add('cast_hidden');
+ launchBtn[i].classList.remove('cast_hidden');
+ launchBtn[i].addEventListener('click', launchCast, false);
+ stopBtn[i].addEventListener('click', stopCast, false);
+ }
}
}
@@ -94,11 +98,11 @@ var castModule = (function () {
return {
init: function () {
- var intro = document.getElementById('download_intro');
- if (intro) {
- intro.insertAdjacentHTML('beforeend', '
');
- window.__onGCastApiAvailable = loadCastApi;
+ var intro = document.getElementsByClassName('download_intro'), i;
+ for (i = 0; i < intro.length; i++) {
+ intro[i].insertAdjacentHTML('beforeend', '
');
}
+ window.__onGCastApiAvailable = loadCastApi;
}
};
}());
diff --git a/templates/video.tpl b/templates/video.tpl
index 64ca555..369370f 100644
--- a/templates/video.tpl
+++ b/templates/video.tpl
@@ -3,92 +3,95 @@
You are going to download - -{$video->title}. -
-{if isset($video->thumbnail)} -