mirror of
https://github.com/p-stream/p-stream.git
synced 2026-05-09 20:30:53 +00:00
no more quickwatch api
This commit is contained in:
parent
6f67a7c7fb
commit
45ecb9d8f5
2 changed files with 55 additions and 55 deletions
|
|
@ -9,7 +9,7 @@ import { getTurnstileToken } from "@/utils/turnstile";
|
||||||
|
|
||||||
// Thanks Nemo for this API
|
// Thanks Nemo for this API
|
||||||
const THE_INTRO_DB_BASE_URL = "https://api.theintrodb.org/v1";
|
const THE_INTRO_DB_BASE_URL = "https://api.theintrodb.org/v1";
|
||||||
const QUICKWATCH_BASE_URL = "https://skips.quickwatch.co";
|
// const QUICKWATCH_BASE_URL = "https://skips.quickwatch.co";
|
||||||
const FED_SKIPS_BASE_URL = "https://fed-skips.pstream.mov";
|
const FED_SKIPS_BASE_URL = "https://fed-skips.pstream.mov";
|
||||||
// const VELORA_BASE_URL = "https://veloratv.ru/api/intro-end/confirmed";
|
// const VELORA_BASE_URL = "https://veloratv.ru/api/intro-end/confirmed";
|
||||||
const INTRODB_BASE_URL = "https://api.introdb.app/intro";
|
const INTRODB_BASE_URL = "https://api.introdb.app/intro";
|
||||||
|
|
@ -20,7 +20,7 @@ let currentSkipTimeSource:
|
||||||
| "fed-skips"
|
| "fed-skips"
|
||||||
| "introdb"
|
| "introdb"
|
||||||
| "theintrodb"
|
| "theintrodb"
|
||||||
| "quickwatch"
|
// | "quickwatch"
|
||||||
| null = null;
|
| null = null;
|
||||||
|
|
||||||
export function useSkipTimeSource(): typeof currentSkipTimeSource {
|
export function useSkipTimeSource(): typeof currentSkipTimeSource {
|
||||||
|
|
@ -119,46 +119,46 @@ export function useSkipTime() {
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
|
|
||||||
const fetchQuickWatchTime = async (): Promise<number | null> => {
|
// const fetchQuickWatchTime = async (): Promise<number | null> => {
|
||||||
if (!meta?.title || meta.type === "movie") return null;
|
// if (!meta?.title || meta.type === "movie") return null;
|
||||||
if (!meta.season?.number || !meta.episode?.number) return null;
|
// if (!meta.season?.number || !meta.episode?.number) return null;
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
const encodedName = encodeURIComponent(meta.title);
|
// const encodedName = encodeURIComponent(meta.title);
|
||||||
const apiUrl = `${QUICKWATCH_BASE_URL}/api/skip-times?name=${encodedName}&season=${meta.season.number}&episode=${meta.episode.number}`;
|
// const apiUrl = `${QUICKWATCH_BASE_URL}/api/skip-times?name=${encodedName}&season=${meta.season.number}&episode=${meta.episode.number}`;
|
||||||
|
|
||||||
const data = await proxiedFetch(apiUrl);
|
// const data = await proxiedFetch(apiUrl);
|
||||||
|
|
||||||
if (!Array.isArray(data) || data.length === 0) return null;
|
// if (!Array.isArray(data) || data.length === 0) return null;
|
||||||
|
|
||||||
// Find the first result with intro or credits data
|
// // Find the first result with intro or credits data
|
||||||
for (const item of data) {
|
// for (const item of data) {
|
||||||
if (item.data) {
|
// if (item.data) {
|
||||||
// Check for intro end time
|
// // Check for intro end time
|
||||||
if (
|
// if (
|
||||||
item.data.intro?.end &&
|
// item.data.intro?.end &&
|
||||||
typeof item.data.intro.end === "number"
|
// typeof item.data.intro.end === "number"
|
||||||
) {
|
// ) {
|
||||||
// Convert milliseconds to seconds
|
// // Convert milliseconds to seconds
|
||||||
return Math.floor(item.data.intro.end / 1000);
|
// return Math.floor(item.data.intro.end / 1000);
|
||||||
}
|
// }
|
||||||
// Check for credits start time (use as intro end)
|
// // Check for credits start time (use as intro end)
|
||||||
if (
|
// if (
|
||||||
item.data.credits?.start &&
|
// item.data.credits?.start &&
|
||||||
typeof item.data.credits.start === "number"
|
// typeof item.data.credits.start === "number"
|
||||||
) {
|
// ) {
|
||||||
// Convert milliseconds to seconds
|
// // Convert milliseconds to seconds
|
||||||
return Math.floor(item.data.credits.start / 1000);
|
// return Math.floor(item.data.credits.start / 1000);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return null;
|
// return null;
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
console.error("Error fetching QuickWatch time:", error);
|
// console.error("Error fetching QuickWatch time:", error);
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
const fetchFedSkipsTime = async (retries = 0): Promise<number | null> => {
|
const fetchFedSkipsTime = async (retries = 0): Promise<number | null> => {
|
||||||
if (!meta?.imdbId || meta.type === "movie") return null;
|
if (!meta?.imdbId || meta.type === "movie") return null;
|
||||||
|
|
@ -237,21 +237,21 @@ export function useSkipTime() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try QuickWatch API (TV shows only) - convert to intro segment
|
// QuickWatch API disabled
|
||||||
const quickWatchTime = await fetchQuickWatchTime();
|
// const quickWatchTime = await fetchQuickWatchTime();
|
||||||
if (quickWatchTime !== null) {
|
// if (quickWatchTime !== null) {
|
||||||
currentSkipTimeSource = "quickwatch";
|
// currentSkipTimeSource = "quickwatch";
|
||||||
setSegments([
|
// setSegments([
|
||||||
{
|
// {
|
||||||
type: "intro",
|
// type: "intro",
|
||||||
start_ms: 0, // Assume starts at beginning
|
// start_ms: 0, // Assume starts at beginning
|
||||||
end_ms: quickWatchTime * 1000, // Convert seconds to milliseconds
|
// end_ms: quickWatchTime * 1000, // Convert seconds to milliseconds
|
||||||
confidence: null,
|
// confidence: null,
|
||||||
submission_count: 1,
|
// submission_count: 1,
|
||||||
},
|
// },
|
||||||
]);
|
// ]);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Fall back to Fed-skips if TheIntroDB and QuickWatch don't have anything
|
// Fall back to Fed-skips if TheIntroDB and QuickWatch don't have anything
|
||||||
// Note: Fed-skips only supports TV shows, not movies
|
// Note: Fed-skips only supports TV shows, not movies
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ interface PendingSkip {
|
||||||
startTime: number;
|
startTime: number;
|
||||||
endTime: number;
|
endTime: number;
|
||||||
hasBackwardMovement: boolean;
|
hasBackwardMovement: boolean;
|
||||||
skipTimeSource: "fed-skips" | "introdb" | "theintrodb" | "quickwatch" | null;
|
skipTimeSource: "fed-skips" | "introdb" | "theintrodb" | null; // | "quickwatch"
|
||||||
timer: ReturnType<typeof setTimeout>;
|
timer: ReturnType<typeof setTimeout>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,8 +77,8 @@ export function SkipTracker() {
|
||||||
// Only send analytics if skip time came from fed-skips or introdb (not theintrodb)
|
// Only send analytics if skip time came from fed-skips or introdb (not theintrodb)
|
||||||
if (
|
if (
|
||||||
pendingSkip.skipTimeSource === "fed-skips" ||
|
pendingSkip.skipTimeSource === "fed-skips" ||
|
||||||
pendingSkip.skipTimeSource === "introdb" ||
|
pendingSkip.skipTimeSource === "introdb"
|
||||||
pendingSkip.skipTimeSource === "quickwatch"
|
// pendingSkip.skipTimeSource === "quickwatch"
|
||||||
) {
|
) {
|
||||||
// Send analytics
|
// Send analytics
|
||||||
sendSkipAnalytics(pendingSkip.skip, adjustedConfidence);
|
sendSkipAnalytics(pendingSkip.skip, adjustedConfidence);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue