From 608ac7b05d63dbf71fc657a05fc77991e4009ef7 Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Wed, 19 Nov 2025 14:07:41 -0700 Subject: [PATCH] Update debrid provider config and stream types Set OVERRIDE_TOKEN and OVERRIDE_SERVICE defaults for debrid providers. Refactor stremioStream type to use infoHash and fileIdx instead of url, and make some behaviorHints properties optional. Add error handling for empty torrentio streams in comboScraper. --- src/providers/sources/debrid/index.ts | 15 ++++++++++++--- src/providers/sources/debrid/types.ts | 8 +++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/providers/sources/debrid/index.ts b/src/providers/sources/debrid/index.ts index 4398019..d04052c 100644 --- a/src/providers/sources/debrid/index.ts +++ b/src/providers/sources/debrid/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import { flags } from '@/entrypoint/utils/targets'; import { SourcererOutput, makeSourcerer } from '@/providers/base'; import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context'; @@ -5,8 +6,8 @@ import { NotFoundError } from '@/utils/errors'; import { debridProviders, torrentioResponse } from './types'; -const OVERRIDE_TOKEN = ''; -const OVERRIDE_SERVICE = ''; // torbox or realdebrid (or real-debrid) +const OVERRIDE_TOKEN = '6f9aebab-42fd-4923--6a213f02fda0'; +const OVERRIDE_SERVICE = 'torbox'; // torbox or realdebrid (or real-debrid) const getDebridToken = (): string | null => { try { @@ -110,7 +111,15 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis } else { torrentioUrl += `movie/${ctx.media.imdbId}.json`; } - const torrentioStreams: torrentioResponse = (await ctx.proxiedFetcher(torrentioUrl)).streams; + const torrentioData = (await ctx.proxiedFetcher(torrentioUrl)) as torrentioResponse; + // console.log('torrentioData', torrentioData); + + const torrentioStreams = torrentioData?.streams || []; + // console.log('torrentioStreams', torrentioStreams); + + if (torrentioStreams.length === 0) { + throw new NotFoundError('No streams found'); + } const response: DebridParsedStream[] = await ctx.proxiedFetcher('https://torrent-parse.pstream.mov/', { method: 'POST', diff --git a/src/providers/sources/debrid/types.ts b/src/providers/sources/debrid/types.ts index 155f9ad..601a8f1 100644 --- a/src/providers/sources/debrid/types.ts +++ b/src/providers/sources/debrid/types.ts @@ -4,13 +4,15 @@ export type debridProviders = 'torbox' | 'real-debrid'; export interface stremioStream { name: string; title: string; - url: string; + infoHash: string; + fileIdx: number; behaviorHints?: { bingeGroup: string; filename: string; - videoSize: number; - videoHash: string; + videoSize?: number; + videoHash?: string; }; + sources?: string[]; } export interface torrentioResponse {