From 67ab4a1f9f22206ff8861fdae5e05861834127d9 Mon Sep 17 00:00:00 2001 From: huangjx Date: Sat, 5 Mar 2022 14:31:06 +0800 Subject: [PATCH] fixed bugs --- lib/Search/Sites/sliderkz.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Search/Sites/sliderkz.php b/lib/Search/Sites/sliderkz.php index d4c5c96..1c10dc5 100644 --- a/lib/Search/Sites/sliderkz.php +++ b/lib/Search/Sites/sliderkz.php @@ -11,11 +11,11 @@ class sliderkz extends searchBase implements searchInterface protected $query = null; protected $tableTitles = []; - public function __construct($crawler,$client) + public function __construct($crawler, $client) { $this->client = $client; } - + public function search(string $keyword): array { $this->query = ['q' => trim($keyword)]; @@ -61,12 +61,11 @@ class sliderkz extends searchBase implements searchInterface try { $response = $this->client->request('GET', $this->searchUrl, ['query' => $this->query]); $resp = $response->toArray(); + if (isset($resp['audios'])) { + return array_values($resp["audios"])[0]; + } } catch (ExceptionInterface $e) { $this->errors[] = $e->getMessage(); - return []; - } - if (isset($resp['audios'])) { - return array_values($resp["audios"])[0]; } return [];