clientService->newClient(); $response = $client->get(self::BASE_URL.'search/podcast', [ 'query' => [ 'title' => $value, 'url' => $value, 'term' => $value, ], ]); $json = (array) json_decode((string) $response->getBody(), true, flags: JSON_THROW_ON_ERROR); if (array_key_exists('data', $json) && is_array($json['data'])) { /** @var string[] $feed */ foreach ($json['data'] as $feed) { $podcasts[] = [ 'provider' => 'fyyd', 'id' => $feed['id'], 'title' => $feed['title'], 'author' => $feed['author'], 'image' => $feed['imgURL'], 'provider_url' => $feed['htmlURL'], 'feed_url' => $feed['xmlURL'], 'last_pub' => $feed['lastpub'], 'nb_episodes' => $feed['episode_count'], ]; } } return $podcasts; } public function hot(): IResponse { $language = 'en'; $userLang = $this->userService->getLangCode(); try { $langClient = $this->clientService->newClient(); $langResponse = $langClient->get(self::BASE_URL.'feature/podcast/hot/languages'); $langJson = (array) json_decode((string) $langResponse->getBody(), true, flags: JSON_THROW_ON_ERROR); if (array_key_exists('data', $langJson) && is_array($langJson['data'])) { $language = in_array($userLang, $langJson['data']) ? $userLang : 'en'; } } catch (\Exception $e) { } $podcastClient = $this->clientService->newClient(); return $podcastClient->get(self::BASE_URL.'feature/podcast/hot', [ 'query' => [ 'language' => $language, ], ]); } }