no more quickwatch api

This commit is contained in:
Pas 2026-01-15 12:41:13 -07:00
parent 6f67a7c7fb
commit 45ecb9d8f5
2 changed files with 55 additions and 55 deletions

View file

@ -9,7 +9,7 @@ import { getTurnstileToken } from "@/utils/turnstile";
// Thanks Nemo for this API
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 VELORA_BASE_URL = "https://veloratv.ru/api/intro-end/confirmed";
const INTRODB_BASE_URL = "https://api.introdb.app/intro";
@ -20,7 +20,7 @@ let currentSkipTimeSource:
| "fed-skips"
| "introdb"
| "theintrodb"
| "quickwatch"
// | "quickwatch"
| null = null;
export function useSkipTimeSource(): typeof currentSkipTimeSource {
@ -119,46 +119,46 @@ export function useSkipTime() {
// }
// };
const fetchQuickWatchTime = async (): Promise<number | null> => {
if (!meta?.title || meta.type === "movie") return null;
if (!meta.season?.number || !meta.episode?.number) return null;
// const fetchQuickWatchTime = async (): Promise<number | null> => {
// if (!meta?.title || meta.type === "movie") return null;
// if (!meta.season?.number || !meta.episode?.number) return null;
try {
const encodedName = encodeURIComponent(meta.title);
const apiUrl = `${QUICKWATCH_BASE_URL}/api/skip-times?name=${encodedName}&season=${meta.season.number}&episode=${meta.episode.number}`;
// try {
// const encodedName = encodeURIComponent(meta.title);
// 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
for (const item of data) {
if (item.data) {
// Check for intro end time
if (
item.data.intro?.end &&
typeof item.data.intro.end === "number"
) {
// Convert milliseconds to seconds
return Math.floor(item.data.intro.end / 1000);
}
// Check for credits start time (use as intro end)
if (
item.data.credits?.start &&
typeof item.data.credits.start === "number"
) {
// Convert milliseconds to seconds
return Math.floor(item.data.credits.start / 1000);
}
}
}
// // Find the first result with intro or credits data
// for (const item of data) {
// if (item.data) {
// // Check for intro end time
// if (
// item.data.intro?.end &&
// typeof item.data.intro.end === "number"
// ) {
// // Convert milliseconds to seconds
// return Math.floor(item.data.intro.end / 1000);
// }
// // Check for credits start time (use as intro end)
// if (
// item.data.credits?.start &&
// typeof item.data.credits.start === "number"
// ) {
// // Convert milliseconds to seconds
// return Math.floor(item.data.credits.start / 1000);
// }
// }
// }
return null;
} catch (error) {
console.error("Error fetching QuickWatch time:", error);
return null;
}
};
// return null;
// } catch (error) {
// console.error("Error fetching QuickWatch time:", error);
// return null;
// }
// };
const fetchFedSkipsTime = async (retries = 0): Promise<number | null> => {
if (!meta?.imdbId || meta.type === "movie") return null;
@ -237,21 +237,21 @@ export function useSkipTime() {
return;
}
// Try QuickWatch API (TV shows only) - convert to intro segment
const quickWatchTime = await fetchQuickWatchTime();
if (quickWatchTime !== null) {
currentSkipTimeSource = "quickwatch";
setSegments([
{
type: "intro",
start_ms: 0, // Assume starts at beginning
end_ms: quickWatchTime * 1000, // Convert seconds to milliseconds
confidence: null,
submission_count: 1,
},
]);
return;
}
// QuickWatch API disabled
// const quickWatchTime = await fetchQuickWatchTime();
// if (quickWatchTime !== null) {
// currentSkipTimeSource = "quickwatch";
// setSegments([
// {
// type: "intro",
// start_ms: 0, // Assume starts at beginning
// end_ms: quickWatchTime * 1000, // Convert seconds to milliseconds
// confidence: null,
// submission_count: 1,
// },
// ]);
// return;
// }
// Fall back to Fed-skips if TheIntroDB and QuickWatch don't have anything
// Note: Fed-skips only supports TV shows, not movies

View file

@ -19,7 +19,7 @@ interface PendingSkip {
startTime: number;
endTime: number;
hasBackwardMovement: boolean;
skipTimeSource: "fed-skips" | "introdb" | "theintrodb" | "quickwatch" | null;
skipTimeSource: "fed-skips" | "introdb" | "theintrodb" | null; // | "quickwatch"
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)
if (
pendingSkip.skipTimeSource === "fed-skips" ||
pendingSkip.skipTimeSource === "introdb" ||
pendingSkip.skipTimeSource === "quickwatch"
pendingSkip.skipTimeSource === "introdb"
// pendingSkip.skipTimeSource === "quickwatch"
) {
// Send analytics
sendSkipAnalytics(pendingSkip.skip, adjustedConfidence);