client = new GuzzleClient([ 'base_uri' => sprintf($this->baseUrl, $this->realDebridKey), ]); } public function get(string $imdbId, array $cacheTags = []): array { $cacheKey = str_replace(":", ".", "torrentio.{$imdbId}"); return $this->cache->get($cacheKey, function (ItemInterface $item) use ($imdbId, $cacheTags) { $item->expiresAt(Carbon::now()->addHour()->setMinute(0)->setSecond(0)); if (count($cacheTags) > 0) { $item->tag($cacheTags); } try { $response = $this->client->get("stream/movie/$imdbId.json"); return json_decode( $response->getBody()->getContents(), true ); } catch (\Throwable $exception) { dd($exception); if ($exception->getCode() === 429) { $this->logger->warning("> [TorrentioClient] Rate limit exceeded"); return null; } } $this->logger->error("> [TorrentioClient] Request error: " . $response->getStatusCode() . " - " . $response->getBody()->getContents()); return []; }); } }