clientService->newClient(); $langResponse = $langClient->get("https://api.fyyd.de/0.2/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'])) { $userLang = $this->l10n->getUserLanguage($this->userSession->getUser()); $userLang = explode('_', $userLang); $userLang = count($userLang) > 1 ? $userLang[1] : $userLang[0]; $userLang = in_array($userLang, $langJson['data']) ? $userLang : 'en'; } } catch (Exception $e) { } try { $podcastClient = $this->clientService->newClient(); $podcastReponse = $podcastClient->get("https://api.fyyd.de/0.2/feature/podcast/hot?count={$count}&language={$userLang}"); $podcastJson = (array) json_decode((string) $podcastReponse->getBody(), true, flags: JSON_THROW_ON_ERROR); return new JSONResponse($podcastJson, $podcastReponse->getStatusCode()); } catch (Exception $e) { return new JSONResponse([$e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR); } } }