endpoint = 'https://api.srgssr.ch/srgssr-play-subtitles/v2/'; parent::__construct(); } public function getUrl(string $urn): string { $response = Http::withHeaders($this->headers)->withQueryParameters([ 'episode' => $urn, ])->get($this->endpoint.'subtitles'); if($response->ok()){ return $response->json()[0]['url']; } return false; } public function save(string $urn): void { $url = $this->getUrl($urn); $response = Http::get($url); Episode::updateOrCreate( ['urn' => $urn], ['subtitles' => $response->body()] ); } }