From e8db3ec9d5b6f6fd301941f407942bc7ed2cae8c Mon Sep 17 00:00:00 2001 From: Jochen Sengier Date: Fri, 27 Sep 2019 13:36:14 +0200 Subject: [PATCH 1/2] Only manipulate thumbnail_url attribute if it's not empty --- src/parsers/Vimeo.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/parsers/Vimeo.php b/src/parsers/Vimeo.php index 767c3e7..2066e7a 100644 --- a/src/parsers/Vimeo.php +++ b/src/parsers/Vimeo.php @@ -54,13 +54,11 @@ public function getVideoInfoWithAPI($id) $response = VideoPlatformsParser::HTTPGet($url); $json = json_decode($response, true); - $json['thumbnail_url'] = str_replace('_295x166', '', $json['thumbnail_url']); - return [ 'id' => $id, 'title' => $json['title'], 'description' => ! empty($json['description']) ? $json['description'] : null, - 'thumbnail' => ! empty($json['thumbnail_url']) ? $json['thumbnail_url'] : null, + 'thumbnail' => ! empty($json['thumbnail_url']) ? str_replace('_295x166', '', $json['thumbnail_url']) : null, 'duration' => ! empty($json['duration']) ? $json['duration'] : 0, 'api' => true ]; From 55ffbb7014a9db4ba9f76377b0d41ad06ed6f4e4 Mon Sep 17 00:00:00 2001 From: Jochen Sengier Date: Fri, 27 Sep 2019 13:42:51 +0200 Subject: [PATCH 2/2] Check if title attribute not empty --- src/parsers/Vimeo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parsers/Vimeo.php b/src/parsers/Vimeo.php index 2066e7a..a6170e7 100644 --- a/src/parsers/Vimeo.php +++ b/src/parsers/Vimeo.php @@ -56,7 +56,7 @@ public function getVideoInfoWithAPI($id) return [ 'id' => $id, - 'title' => $json['title'], + 'title' => ! empty($json['title']) ? $json['title'] : null, 'description' => ! empty($json['description']) ? $json['description'] : null, 'thumbnail' => ! empty($json['thumbnail_url']) ? str_replace('_295x166', '', $json['thumbnail_url']) : null, 'duration' => ! empty($json['duration']) ? $json['duration'] : 0,