$term.($album ? " $album" : '').($artist ? " $artist" : ''), 'media' => 'music', 'entity' => 'song', 'limit' => 1, ]; $response = (string) $this->client->get($this->getEndpoint(), ['query' => $params])->getBody(); $response = json_decode($response); if (!$response->resultCount) { return false; } $trackUrl = $response->results[0]->trackViewUrl; $connector = parse_url($trackUrl, PHP_URL_QUERY) ? '&' : '?'; $trackUrl .= "{$connector}at=".config('koel.itunes.affiliate_id'); return $trackUrl; } ); } catch (Exception $e) { Log::error($e); return false; } } public function getKey() { } public function getSecret() { } public function getEndpoint() { return config('koel.itunes.endpoint'); } }