From 5d7c8f0c9f2be5fe3f78591b2be17b14d52a78d0 Mon Sep 17 00:00:00 2001 From: Chewbaka69 Date: Wed, 21 Nov 2018 14:42:08 +0100 Subject: [PATCH] Update movie get trailer --- fuel/app/classes/model/movie.php | 40 ++------------------------------ 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/fuel/app/classes/model/movie.php b/fuel/app/classes/model/movie.php index 5faf0bb..1b178f7 100644 --- a/fuel/app/classes/model/movie.php +++ b/fuel/app/classes/model/movie.php @@ -414,43 +414,7 @@ class Model_Movie extends Model_Overwrite public function getTrailer() { - if($this->type === 'movie') { - - $html = Request::forge('https://www.themoviedb.org/search/movie?query=' . urlencode($this->originalTitle ?: $this->title) . '+y%3A' . $this->year . '&language=us', 'curl'); - $html->execute(); - - if ($html->response()->status !== 200) - return false; - - $media = $html->response()->body; - - preg_match('//i', $media, $urls); - - if (!isset($urls[1])) - return false; - - $url = explode('?', $urls[1]); - - $html = Request::forge('https://www.themoviedb.org' . $url[0] . '/videos?active_nav_item=Trailers&video_language=en-US&language=en-US', 'curl'); - $html->set_options(array( - CURLOPT_FOLLOWLOCATION => true, - ) - ); - $html->execute(); - - if ($html->response()->status !== 200) - return false; - - $media = $html->response()->body; - - preg_match('/