fix: torrentio client
This commit is contained in:
@@ -13,7 +13,7 @@ class HttpClient
|
|||||||
{
|
{
|
||||||
private GuzzleClient $client;
|
private GuzzleClient $client;
|
||||||
|
|
||||||
private string $baseUrl = 'https://torrentio.strem.fun/realdebrid=%s/stream/movie/';
|
private string $baseUrl = 'https://torrentio.strem.fun/realdebrid=%s/';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
#[Autowire(env: 'REAL_DEBRID_KEY')] private string $realDebridKey,
|
#[Autowire(env: 'REAL_DEBRID_KEY')] private string $realDebridKey,
|
||||||
@@ -27,7 +27,7 @@ class HttpClient
|
|||||||
|
|
||||||
public function get(string $imdbId, array $cacheTags = []): array
|
public function get(string $imdbId, array $cacheTags = []): array
|
||||||
{
|
{
|
||||||
$cacheKey = "torrentio.{$imdbId}";
|
$cacheKey = str_replace(":", ".", "torrentio.{$imdbId}");
|
||||||
|
|
||||||
return $this->cache->get($cacheKey, function (ItemInterface $item) use ($imdbId, $cacheTags) {
|
return $this->cache->get($cacheKey, function (ItemInterface $item) use ($imdbId, $cacheTags) {
|
||||||
$item->expiresAt(Carbon::now()->addHour()->setMinute(0)->setSecond(0));
|
$item->expiresAt(Carbon::now()->addHour()->setMinute(0)->setSecond(0));
|
||||||
@@ -35,7 +35,7 @@ class HttpClient
|
|||||||
$item->tag($cacheTags);
|
$item->tag($cacheTags);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$response = $this->client->get("$imdbId.json");
|
$response = $this->client->get("stream/movie/$imdbId.json");
|
||||||
return json_decode(
|
return json_decode(
|
||||||
$response->getBody()->getContents(),
|
$response->getBody()->getContents(),
|
||||||
true
|
true
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Torrentio
|
|||||||
public function fetchEpisodeResults(string $imdbId, int $season, int $episode, bool $parseResults = true): array
|
public function fetchEpisodeResults(string $imdbId, int $season, int $episode, bool $parseResults = true): array
|
||||||
{
|
{
|
||||||
$cacheTags = ['torrentio', 'tvshows', 'torrentio.tvshows', $imdbId, "torrentio.$imdbId", "$imdbId.$season", "torrentio.$imdbId.$season", "$imdbId.$season.$episode", "torrentio.$imdbId.$season.$episode"];
|
$cacheTags = ['torrentio', 'tvshows', 'torrentio.tvshows', $imdbId, "torrentio.$imdbId", "$imdbId.$season", "torrentio.$imdbId.$season", "$imdbId.$season.$episode", "torrentio.$imdbId.$season.$episode"];
|
||||||
$results = $this->client->get($imdbId, $cacheTags);
|
$results = $this->client->get("$imdbId:$season:$episode", $cacheTags);
|
||||||
|
|
||||||
if (null === $results) {
|
if (null === $results) {
|
||||||
throw new TorrentioRateLimitException();
|
throw new TorrentioRateLimitException();
|
||||||
|
|||||||
Reference in New Issue
Block a user