mirror of
https://github.com/p-stream/p-stream.git
synced 2026-05-21 17:02:06 +00:00
parent
796b3e85cc
commit
8fa57d9f2c
1 changed files with 4 additions and 19 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
import { SimpleCache } from "@/utils/cache";
|
import { SimpleCache } from "@/utils/cache";
|
||||||
import { getTurnstileToken } from "@/utils/turnstile";
|
|
||||||
|
|
||||||
import { getMediaDetails } from "./tmdb";
|
import { getMediaDetails } from "./tmdb";
|
||||||
import { TMDBContentTypes, TMDBMovieData } from "./types/tmdb";
|
import { TMDBContentTypes, TMDBMovieData } from "./types/tmdb";
|
||||||
|
|
@ -61,15 +60,8 @@ async function fetchFromTrakt<T = TraktListResponse>(
|
||||||
return cachedResult as T;
|
return cachedResult as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Turnstile token for verification
|
// Make the API request
|
||||||
const turnstileToken = await getTurnstileToken("0x4AAAAAAB6ocCCpurfWRZyC");
|
const response = await fetch(`${TRAKT_BASE_URL}${endpoint}`);
|
||||||
|
|
||||||
// Make the API request with Turnstile token
|
|
||||||
const response = await fetch(`${TRAKT_BASE_URL}${endpoint}`, {
|
|
||||||
headers: {
|
|
||||||
"cf-turnstile-response": turnstileToken,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to fetch from ${endpoint}: ${response.statusText}`);
|
throw new Error(`Failed to fetch from ${endpoint}: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
@ -99,15 +91,8 @@ export async function getReleaseDetails(
|
||||||
return cachedResult as TraktReleaseResponse;
|
return cachedResult as TraktReleaseResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Turnstile token for verification
|
// Make the API request
|
||||||
const turnstileToken = await getTurnstileToken("0x4AAAAAAB6ocCCpurfWRZyC");
|
const response = await fetch(`${TRAKT_BASE_URL}${url}`);
|
||||||
|
|
||||||
// Make the API request with Turnstile token
|
|
||||||
const response = await fetch(`${TRAKT_BASE_URL}${url}`, {
|
|
||||||
headers: {
|
|
||||||
"cf-turnstile-response": turnstileToken,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to fetch release details: ${response.statusText}`);
|
throw new Error(`Failed to fetch release details: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue