mirror of
https://github.com/p-stream/providers.git
synced 2026-01-11 20:10:33 +00:00
Squashed commit of the following:
commitb03b4e9f68Author: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Wed Nov 19 17:27:57 2025 -0700 Update index.ts commite524125a2bAuthor: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Wed Nov 19 15:55:49 2025 -0700 Update index.ts commit608ac7b05dAuthor: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Wed Nov 19 14:07:41 2025 -0700 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. commit534915773fAuthor: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Wed Nov 19 12:35:10 2025 -0700 enable debrid commit4144feb1b0Author: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Wed Nov 19 12:36:57 2025 -0700 prettier
This commit is contained in:
parent
9bb86d04be
commit
da560af039
2 changed files with 24 additions and 5 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';
|
||||
|
|
@ -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;
|
||||
|
||||
const torrentioStreams = torrentioData?.streams || [];
|
||||
if (torrentioStreams.length === 0) {
|
||||
console.log('No torrents found', torrentioData);
|
||||
throw new NotFoundError('No torrents found');
|
||||
}
|
||||
|
||||
ctx.progress(33);
|
||||
|
||||
const response: DebridParsedStream[] = await ctx.proxiedFetcher('https://torrent-parse.pstream.mov/', {
|
||||
method: 'POST',
|
||||
|
|
@ -119,6 +128,12 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
},
|
||||
body: JSON.stringify(torrentioStreams),
|
||||
});
|
||||
if (response.length === 0) {
|
||||
console.log('No streams found or parse failed!', response);
|
||||
throw new NotFoundError('No streams found or parse failed!');
|
||||
}
|
||||
|
||||
ctx.progress(66);
|
||||
|
||||
// Group by quality, pick the most compatible stream for each
|
||||
const qualities: Partial<Record<'4k' | 1080 | 720 | 480 | 360 | 'unknown', { type: 'mp4'; url: string }>> = {};
|
||||
|
|
@ -161,6 +176,8 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
}
|
||||
}
|
||||
|
||||
ctx.progress(100);
|
||||
|
||||
return {
|
||||
embeds: [],
|
||||
stream: [
|
||||
|
|
@ -179,7 +196,7 @@ export const debridScraper = makeSourcerer({
|
|||
id: 'debrid',
|
||||
name: 'Debrid',
|
||||
rank: 999,
|
||||
disabled: true,
|
||||
disabled: false,
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
scrapeMovie: comboScraper,
|
||||
scrapeShow: comboScraper,
|
||||
|
|
|
|||
|
|
@ -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