$term.($album ? " $album" : '').($artist ? " $artist" : ''), 'media' => 'music', 'entity' => 'song', 'limit' => 1, ]; $response = json_decode( $this->getClient()->get($this->getEndpoint(), ['query' => $params])->getBody() ); if (!$response->resultCount) { return null; } $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 null; } } public function getKey(): ?string { return null; } public function getSecret(): ?string { return null; } public function getEndpoint(): string { return config('koel.itunes.endpoint'); } }