mirror of
https://github.com/sussy-code/providers.git
synced 2026-08-14 03:14:54 +00:00
add slidemovies
This commit is contained in:
parent
91e3e11fa5
commit
6a52b94593
2 changed files with 76 additions and 0 deletions
|
|
@ -91,6 +91,7 @@ import { nepuScraper } from './sources/nepu';
|
|||
import { nitesScraper } from './sources/nites';
|
||||
import { primewireScraper } from './sources/primewire';
|
||||
import { ridooMoviesScraper } from './sources/ridomovies';
|
||||
import { slidemoviesScraper } from './sources/slidemovies';
|
||||
import { smashyStreamScraper } from './sources/smashystream';
|
||||
import { soaperTvScraper } from './sources/soapertv';
|
||||
import { vidlinkScraper } from './sources/vidlink';
|
||||
|
|
@ -138,6 +139,7 @@ export function gatherAllSources(): Array<Sourcerer> {
|
|||
vidlinkScraper,
|
||||
FedAPIScraper,
|
||||
iosmirrorScraper,
|
||||
slidemoviesScraper,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
74
src/providers/sources/slidemovies.ts
Normal file
74
src/providers/sources/slidemovies.ts
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
import { load } from 'cheerio';
|
||||
|
||||
import { flags } from '@/entrypoint/utils/targets';
|
||||
import { SourcererOutput, makeSourcerer } from '@/providers/base';
|
||||
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
||||
import { NotFoundError } from '@/utils/errors';
|
||||
|
||||
const baseUrl = 'https://pupp.slidemovies-dev.workers.dev';
|
||||
|
||||
async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> {
|
||||
const watchPageUrl =
|
||||
ctx.media.type === 'movie'
|
||||
? `${baseUrl}/movie/${ctx.media.tmdbId}`
|
||||
: `${baseUrl}/tv/${ctx.media.tmdbId}/${ctx.media.season.number}/-${ctx.media.episode.number}`;
|
||||
|
||||
ctx.progress(60);
|
||||
|
||||
const watchPage = await ctx.proxiedFetcher(watchPageUrl);
|
||||
const $ = load(watchPage);
|
||||
|
||||
const proxiedStreamUrl = $('media-player').attr('src');
|
||||
|
||||
if (!proxiedStreamUrl) {
|
||||
throw new NotFoundError('Stream URL not found');
|
||||
}
|
||||
|
||||
const isoLanguageMap: Record<string, string> = {
|
||||
ng: 'en',
|
||||
re: 'fr',
|
||||
pa: 'es',
|
||||
};
|
||||
|
||||
const captions = $('media-provider track')
|
||||
.map((_, el) => {
|
||||
const url = $(el).attr('src') || '';
|
||||
const rawLang = $(el).attr('lang') || 'unknown';
|
||||
const languageCode = isoLanguageMap[rawLang] || rawLang;
|
||||
const isVtt = url.endsWith('.vtt') ? 'vtt' : 'srt';
|
||||
|
||||
return {
|
||||
type: isVtt as 'vtt' | 'srt',
|
||||
id: url,
|
||||
url,
|
||||
language: languageCode,
|
||||
hasCorsRestrictions: false,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.progress(90);
|
||||
|
||||
return {
|
||||
embeds: [],
|
||||
stream: [
|
||||
{
|
||||
id: 'primary',
|
||||
type: 'hls',
|
||||
flags: [],
|
||||
playlist: proxiedStreamUrl,
|
||||
captions,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const slidemoviesScraper = makeSourcerer({
|
||||
id: 'slidemovies',
|
||||
name: 'SlideMovies',
|
||||
rank: 181,
|
||||
disabled: false,
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
scrapeMovie: comboScraper,
|
||||
scrapeShow: comboScraper,
|
||||
});
|
||||
Loading…
Reference in a new issue