mirror of
https://github.com/p-stream/providers.git
synced 2026-01-11 20:10:33 +00:00
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.
This commit is contained in:
parent
534915773f
commit
608ac7b05d
2 changed files with 17 additions and 6 deletions
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue