36 Commits

Author SHA1 Message Date
William Oldham
fe04267494 Merge pull request #152 from movie-web/dev
Version 2.3.0: Disabling Showbox
2024-04-13 18:52:55 +01:00
Jorrin
89a78e4ae9 disable vidsrc 2024-04-12 18:30:21 +02:00
Jorrin
3826b8d887 Merge branch 'master' into dev 2024-04-12 17:43:37 +02:00
Jorrin
f0d9ee2944 Merge branch 'dev' of https://github.com/movie-web/providers into dev 2024-04-12 17:42:52 +02:00
Jorrin
8de7e61eab bump version + changelog 2024-04-12 17:42:44 +02:00
Jorrin
95617763d0 Merge pull request #151 from lonelil/dev
add WarezCDN
2024-04-12 17:37:01 +02:00
lonelil
0a2259b1f4 remove user-agent 2024-04-12 16:59:51 +08:00
lonelil
79a8fdca6d fix series 2024-04-12 16:56:14 +08:00
Jorrin
94bfcd0c31 skip validation check for warezcdnmp4 2024-04-11 20:42:37 +02:00
Jorrin
ef600dd08c Merge branch 'dev' into pr/151 2024-04-11 19:55:23 +02:00
Jorrin
025b6821e6 Merge pull request #146 from infvortx/dev
Add Insertunit provider
2024-04-11 19:46:21 +02:00
Jorrin
356286dfaa Merge branch 'dev' of https://github.com/infvortx/providers-dev into pr/146 2024-04-11 19:44:19 +02:00
Jorrin
534b53f9b9 Merge branch 'dev' into pr/146 2024-04-11 19:44:06 +02:00
lonelil
089c6aa6ce add flag and change rank 2024-04-12 01:11:29 +08:00
teddyHV11
2553909e8d Merge branch 'dev' of https://github.com/infvortx/providers-dev into dev 2024-04-11 17:49:33 +03:00
teddyHV11
6a0ac52908 Fix prettier errors 2024-04-11 17:49:32 +03:00
Jorrin
116cc1c3c3 Merge pull request #149 from movie-web/feature/soapertv
Add soapertv source
2024-04-11 15:50:32 +02:00
Jorrin
0ede244c2b Merge branch 'dev' into dev 2024-04-11 15:48:11 +02:00
chaos
5be81a3142 Merge branch 'dev' into feature/soapertv 2024-04-11 14:37:36 +03:00
teddyHV11
8281c3141a Rename insertunit.ts to index.ts 2024-04-11 06:31:53 +03:00
teddyHV11
8796b39a63 Fix prettier errors 2024-04-11 04:18:38 +03:00
teddyHV11
6b038a288c Clarity fixes 2024-04-11 03:57:42 +03:00
Jorrin
ec6524389c add soapertv source 2024-04-10 22:40:55 +02:00
teddyHV11
5d6b93385e Types adjustment, extract captions to a function 2024-04-10 07:24:53 +03:00
teddyHV11
5b836a4839 Fix mistake done with captions
Swap languages and type's place
2024-04-09 17:44:41 +03:00
infvortx
082d2754be Merge branch 'movie-web:dev' into dev 2024-04-09 09:49:32 +03:00
teddyHV11
921c35b3ed Add caption scraping + types 2024-04-09 07:16:41 +03:00
Jorrin
fbbb671967 Merge branch 'dev' into dev 2024-04-08 16:09:37 +02:00
teddyHV11
7dc5a5ac83 Fix series scraping
Series scraping was off for some series, this fixes it + also adds support for episodes that are in multiple parts (continuation of each other) as the provider returns them as a single file in episode ranges.
2024-04-07 15:33:04 +03:00
teddyHV11
73facc0184 Merge branch 'dev' of https://github.com/infvortx/providers-dev into dev 2024-04-07 11:54:37 +03:00
teddyHV11
68fe85065f Updated provider name 2024-04-07 11:54:34 +03:00
infvortx
8a711265cb Update insertunit.ts 2024-04-07 11:48:04 +03:00
infvortx
a58ea29ae5 Merge branch 'movie-web:dev' into dev 2024-04-07 10:53:44 +03:00
teddyHV11
d99a22d734 Add insertunit 2024-04-07 10:53:09 +03:00
Jorrin
53fbc3b42d Merge pull request #144 from movie-web/dev
Version 2.2.9
2024-04-05 20:04:21 +02:00
Jorrin
8abc8b96e4 Merge pull request #137 from movie-web/dev
Version 2.2.8
2024-04-02 22:09:13 +02:00
17 changed files with 463 additions and 72 deletions

View File

@@ -2,6 +2,11 @@
title: 'Changelog' title: 'Changelog'
--- ---
# Version 2.3.0
- Fixed RidoMovies search results
- Added Insertunit, SoaperTV, and WarezCDN providers
- Disabled Showbox and VidSrc
# Version 2.2.9 # Version 2.2.9
- Fixed VidSrcTo (both Vidplay and Filemoon embeds) - Fixed VidSrcTo (both Vidplay and Filemoon embeds)
- Added dropload, filelions and vtube embeds to Primewire - Added dropload, filelions and vtube embeds to Primewire

View File

@@ -1,6 +1,6 @@
{ {
"name": "@movie-web/providers", "name": "@movie-web/providers",
"version": "2.2.9", "version": "2.3.0",
"description": "Package that contains all the providers of movie-web", "description": "Package that contains all the providers of movie-web",
"type": "module", "type": "module",
"main": "./lib/index.js", "main": "./lib/index.js",

View File

@@ -14,6 +14,7 @@ import { vidsrcembedScraper } from '@/providers/embeds/vidsrc';
import { vTubeScraper } from '@/providers/embeds/vtube'; import { vTubeScraper } from '@/providers/embeds/vtube';
import { flixhqScraper } from '@/providers/sources/flixhq/index'; import { flixhqScraper } from '@/providers/sources/flixhq/index';
import { goMoviesScraper } from '@/providers/sources/gomovies/index'; import { goMoviesScraper } from '@/providers/sources/gomovies/index';
import { insertunitScraper } from '@/providers/sources/insertunit';
import { kissAsianScraper } from '@/providers/sources/kissasian/index'; import { kissAsianScraper } from '@/providers/sources/kissasian/index';
import { lookmovieScraper } from '@/providers/sources/lookmovie'; import { lookmovieScraper } from '@/providers/sources/lookmovie';
import { remotestreamScraper } from '@/providers/sources/remotestream'; import { remotestreamScraper } from '@/providers/sources/remotestream';
@@ -40,6 +41,7 @@ import { nepuScraper } from './sources/nepu';
import { primewireScraper } from './sources/primewire'; import { primewireScraper } from './sources/primewire';
import { ridooMoviesScraper } from './sources/ridomovies'; import { ridooMoviesScraper } from './sources/ridomovies';
import { smashyStreamScraper } from './sources/smashystream'; import { smashyStreamScraper } from './sources/smashystream';
import { soaperTvScraper } from './sources/soapertv';
import { vidSrcToScraper } from './sources/vidsrcto'; import { vidSrcToScraper } from './sources/vidsrcto';
import { warezcdnScraper } from './sources/warezcdn'; import { warezcdnScraper } from './sources/warezcdn';
@@ -62,6 +64,8 @@ export function gatherAllSources(): Array<Sourcerer> {
hdRezkaScraper, hdRezkaScraper,
primewireScraper, primewireScraper,
warezcdnScraper, warezcdnScraper,
insertunitScraper,
soaperTvScraper,
]; ];
} }

View File

@@ -21,7 +21,7 @@ async function getVideowlUrlStream(ctx: EmbedScrapeContext, decryptedId: string)
export const warezcdnembedHlsScraper = makeEmbed({ export const warezcdnembedHlsScraper = makeEmbed({
id: 'warezcdnembedhls', // WarezCDN is both a source and an embed host id: 'warezcdnembedhls', // WarezCDN is both a source and an embed host
name: 'WarezCDN HLS', name: 'WarezCDN HLS',
rank: 82, rank: 83,
async scrape(ctx) { async scrape(ctx) {
const decryptedId = await getDecryptedId(ctx); const decryptedId = await getDecryptedId(ctx);

View File

@@ -1,3 +1,4 @@
import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '@/providers/base'; import { makeEmbed } from '@/providers/base';
import { warezcdnWorkerProxy } from '@/providers/sources/warezcdn/common'; import { warezcdnWorkerProxy } from '@/providers/sources/warezcdn/common';
import { EmbedScrapeContext } from '@/utils/context'; import { EmbedScrapeContext } from '@/utils/context';
@@ -24,7 +25,7 @@ async function checkUrls(ctx: EmbedScrapeContext, fileId: string) {
export const warezcdnembedMp4Scraper = makeEmbed({ export const warezcdnembedMp4Scraper = makeEmbed({
id: 'warezcdnembedmp4', // WarezCDN is both a source and an embed host id: 'warezcdnembedmp4', // WarezCDN is both a source and an embed host
name: 'WarezCDN MP4', name: 'WarezCDN MP4',
rank: 83, rank: 82,
disabled: false, disabled: false,
async scrape(ctx) { async scrape(ctx) {
const decryptedId = await getDecryptedId(ctx); const decryptedId = await getDecryptedId(ctx);
@@ -49,7 +50,7 @@ export const warezcdnembedMp4Scraper = makeEmbed({
}, },
}, },
type: 'file', type: 'file',
flags: [], flags: [flags.CORS_ALLOWED],
}, },
], ],
}; };

View File

@@ -0,0 +1,30 @@
import { Caption, removeDuplicatedLanguages } from '@/providers/captions';
import { Subtitle } from './types';
export async function getCaptions(data: Subtitle[]) {
let captions: Caption[] = [];
for (const subtitle of data) {
let language = '';
if (subtitle.name.includes('Рус')) {
language = 'ru';
} else if (subtitle.name.includes('Укр')) {
language = 'uk';
} else if (subtitle.name.includes('Eng')) {
language = 'en';
} else {
continue;
}
captions.push({
id: subtitle.url,
url: subtitle.url,
language,
type: 'vtt',
hasCorsRestrictions: false,
});
}
captions = removeDuplicatedLanguages(captions);
return captions;
}

View File

@@ -0,0 +1,103 @@
import { flags } from '@/entrypoint/utils/targets';
import { makeSourcerer } from '@/providers/base';
import { Caption } from '@/providers/captions';
import { NotFoundError } from '@/utils/errors';
import { getCaptions } from './captions';
import { Season } from './types';
const insertUnitBase = 'https://api.insertunit.ws/';
export const insertunitScraper = makeSourcerer({
id: 'insertunit',
name: 'Insertunit',
disabled: false,
rank: 60,
flags: [flags.CORS_ALLOWED],
async scrapeShow(ctx) {
const playerData = await ctx.fetcher<string>(`/embed/imdb/${ctx.media.imdbId}`, {
baseUrl: insertUnitBase,
});
ctx.progress(30);
const seasonDataJSONregex = /seasons:(.*)/;
const seasonData = seasonDataJSONregex.exec(playerData);
if (seasonData === null || seasonData[1] === null) {
throw new NotFoundError('No result found');
}
ctx.progress(60);
const seasonTable: Season[] = JSON.parse(seasonData[1]) as Season[];
const currentSeason = seasonTable.find(
(seasonElement) => seasonElement.season === ctx.media.season.number && !seasonElement.blocked,
);
const currentEpisode = currentSeason?.episodes.find((episodeElement) =>
episodeElement.episode.includes(ctx.media.episode.number.toString()),
);
if (!currentEpisode?.hls) throw new NotFoundError('No result found');
let captions: Caption[] = [];
if (currentEpisode.cc != null) {
captions = await getCaptions(currentEpisode.cc);
}
ctx.progress(95);
return {
embeds: [],
stream: [
{
id: 'primary',
playlist: currentEpisode.hls,
type: 'hls',
flags: [flags.CORS_ALLOWED],
captions,
},
],
};
},
async scrapeMovie(ctx) {
const playerData = await ctx.fetcher<string>(`/embed/imdb/${ctx.media.imdbId}`, {
baseUrl: insertUnitBase,
});
ctx.progress(35);
const streamRegex = /hls: "([^"]*)/;
const streamData = streamRegex.exec(playerData);
if (streamData === null || streamData[1] === null) {
throw new NotFoundError('No result found');
}
ctx.progress(75);
const subtitleRegex = /cc: (.*)/;
const subtitleJSONData = subtitleRegex.exec(playerData);
let captions: Caption[] = [];
if (subtitleJSONData != null && subtitleJSONData[1] != null) {
const subtitleData = JSON.parse(subtitleJSONData[1]);
captions = await getCaptions(subtitleData);
}
ctx.progress(90);
return {
embeds: [],
stream: [
{
id: 'primary',
type: 'hls',
playlist: streamData[1],
flags: [flags.CORS_ALLOWED],
captions,
},
],
};
},
});

View File

@@ -0,0 +1,30 @@
export interface Subtitle {
url: string;
name: string;
}
export interface Episode {
episode: string;
id: number;
videoKey: string;
hls: string;
audio: {
names: string[];
order: number[];
};
cc: Subtitle[];
duration: number;
title: string;
download: string;
sections: string[];
poster: string;
preview: {
src: string;
};
}
export interface Season {
season: number;
blocked: boolean;
episodes: Episode[];
}

View File

@@ -0,0 +1,120 @@
import { load } from 'cheerio';
import { flags } from '@/entrypoint/utils/targets';
import { Caption, labelToLanguageCode } from '@/providers/captions';
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
import { NotFoundError } from '@/utils/errors';
import { InfoResponse } from './types';
import { SourcererOutput, makeSourcerer } from '../../base';
const baseUrl = 'https://soaper.tv';
const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext): Promise<SourcererOutput> => {
const searchResult = await ctx.proxiedFetcher('/search.html', {
baseUrl,
query: {
keyword: ctx.media.title,
},
});
const searchResult$ = load(searchResult);
let showLink = searchResult$('a')
.filter((_, el) => searchResult$(el).text() === ctx.media.title)
.attr('href');
if (!showLink) throw new NotFoundError('Content not found');
if (ctx.media.type === 'show') {
const seasonNumber = ctx.media.season.number;
const episodeNumber = ctx.media.episode.number;
const showPage = await ctx.proxiedFetcher(showLink, { baseUrl });
const showPage$ = load(showPage);
const seasonBlock = showPage$('h4')
.filter((_, el) => showPage$(el).text().trim().split(':')[0].trim() === `Season${seasonNumber}`)
.parent();
const episodes = seasonBlock.find('a').toArray();
showLink = showPage$(
episodes.find((el) => parseInt(showPage$(el).text().split('.')[0], 10) === episodeNumber),
).attr('href');
}
if (!showLink) throw new NotFoundError('Content not found');
const contentPage = await ctx.proxiedFetcher(showLink, { baseUrl });
const contentPage$ = load(contentPage);
const pass = contentPage$('#hId').attr('value');
const param = contentPage$('#divU').text();
if (!pass || !param) throw new NotFoundError('Content not found');
const formData = new URLSearchParams();
formData.append('pass', pass);
formData.append('param', param);
formData.append('e2', '0');
formData.append('server', '0');
const infoEndpoint = ctx.media.type === 'show' ? '/home/index/getEInfoAjax' : '/home/index/getMInfoAjax';
const streamRes = await ctx.proxiedFetcher<string>(infoEndpoint, {
baseUrl,
method: 'POST',
body: formData,
headers: {
referer: `${baseUrl}${showLink}`,
},
});
const streamResJson: InfoResponse = JSON.parse(streamRes);
const captions: Caption[] = [];
for (const sub of streamResJson.subs) {
// Some subtitles are named <Language>.srt, some are named <LanguageCode>:hi, or just <LanguageCode>
let language: string | null = '';
if (sub.name.includes('.srt')) {
language = labelToLanguageCode(sub.name.split('.srt')[0]);
} else if (sub.name.includes(':')) {
language = sub.name.split(':')[0];
} else {
language = sub.name;
}
if (!language) continue;
captions.push({
id: sub.path,
url: sub.path,
type: 'srt',
hasCorsRestrictions: false,
language,
});
}
return {
embeds: [],
stream: [
{
id: 'primary',
playlist: streamResJson.val,
type: 'hls',
flags: [flags.IP_LOCKED],
captions,
},
...(streamResJson.val_bak
? [
{
id: 'backup',
playlist: streamResJson.val_bak,
type: 'hls' as const,
flags: [flags.IP_LOCKED],
captions,
},
]
: []),
],
};
};
export const soaperTvScraper = makeSourcerer({
id: 'soapertv',
name: 'SoaperTV',
rank: 115,
flags: [flags.IP_LOCKED],
scrapeMovie: universalScraper,
scrapeShow: universalScraper,
});

View File

@@ -0,0 +1,15 @@
export interface Subtitle {
path: string;
name: string;
}
export interface InfoResponse {
key: boolean;
val: string;
vtt: string;
val_bak: string;
pos: number;
type: string;
subs: Subtitle[];
ip: string;
}

View File

@@ -6,6 +6,7 @@ export const vidsrcScraper = makeSourcerer({
id: 'vidsrc', id: 'vidsrc',
name: 'VidSrc', name: 'VidSrc',
rank: 90, rank: 90,
disabled: true,
flags: [], flags: [],
scrapeMovie, scrapeMovie,
scrapeShow, scrapeShow,

View File

@@ -1,4 +1,24 @@
import { ScrapeContext } from '@/utils/context';
export const warezcdnBase = 'https://embed.warezcdn.com'; export const warezcdnBase = 'https://embed.warezcdn.com';
export const warezcdnApiBase = 'https://warezcdn.com/embed'; export const warezcdnApiBase = 'https://warezcdn.com/embed';
export const warezcdnPlayerBase = 'https://warezcdn.com/player'; export const warezcdnPlayerBase = 'https://warezcdn.com/player';
export const warezcdnWorkerProxy = 'https://workerproxy.warezcdn.workers.dev'; export const warezcdnWorkerProxy = 'https://workerproxy.warezcdn.workers.dev';
export async function getExternalPlayerUrl(ctx: ScrapeContext, embedId: string, embedUrl: string) {
const params = {
id: embedUrl,
sv: embedId,
};
const realUrl = await ctx.proxiedFetcher<string>(`/getPlay.php`, {
baseUrl: warezcdnApiBase,
headers: {
Referer: `${warezcdnApiBase}/getEmbed.php?${new URLSearchParams(params)}`,
},
query: params,
});
const realEmbedUrl = realUrl.match(/window\.location\.href="([^"]*)";/);
if (!realEmbedUrl) throw new Error('Could not find embed url');
return realEmbedUrl[1];
}

View File

@@ -1,77 +1,114 @@
import { load } from 'cheerio'; import { load } from 'cheerio';
import { flags } from '@/entrypoint/utils/targets';
import { SourcererEmbed, makeSourcerer } from '@/providers/base'; import { SourcererEmbed, makeSourcerer } from '@/providers/base';
import { mixdropScraper } from '@/providers/embeds/mixdrop'; import { mixdropScraper } from '@/providers/embeds/mixdrop';
import { warezcdnembedHlsScraper } from '@/providers/embeds/warezcdn/hls'; import { warezcdnembedHlsScraper } from '@/providers/embeds/warezcdn/hls';
import { warezcdnembedMp4Scraper } from '@/providers/embeds/warezcdn/mp4'; import { warezcdnembedMp4Scraper } from '@/providers/embeds/warezcdn/mp4';
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
import { NotFoundError } from '@/utils/errors'; import { NotFoundError } from '@/utils/errors';
import { warezcdnApiBase, warezcdnBase } from './common'; import { getExternalPlayerUrl, warezcdnBase } from './common';
import { SerieAjaxResponse } from './types';
const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) => {
if (!ctx.media.imdbId) throw new NotFoundError('This source requires IMDB id.');
let id = `filme/${ctx.media.imdbId}`;
if (ctx.media.type === 'show')
id = `serie/${ctx.media.imdbId}/${ctx.media.season.number}/${ctx.media.episode.number}`;
const serversPage = await ctx.proxiedFetcher<string>(`/${id}`, {
baseUrl: warezcdnBase,
});
const $ = load(serversPage);
const embedsHost = $('.hostList.active [data-load-embed]').get();
const embeds: SourcererEmbed[] = [];
embedsHost.forEach(async (element) => {
const embedHost = $(element).attr('data-load-embed-host')!;
const embedUrl = $(element).attr('data-load-embed')!;
if (embedHost === 'mixdrop') {
const params = {
id: embedUrl,
sv: 'mixdrop',
};
const realUrl = await ctx.proxiedFetcher<string>(`/getPlay.php`, {
baseUrl: warezcdnApiBase,
headers: {
Referer: `${warezcdnApiBase}/getEmbed.php?${new URLSearchParams(params)}`,
},
query: params,
});
const realEmbedUrl = realUrl.match(/window\.location\.href="([^"]*)";/);
if (!realEmbedUrl) throw new Error('Could not find embed url');
embeds.push({
embedId: mixdropScraper.id,
url: realEmbedUrl[1],
});
} else if (embedHost === 'warezcdn') {
embeds.push(
{
embedId: warezcdnembedHlsScraper.id,
url: embedUrl,
},
{
embedId: warezcdnembedMp4Scraper.id,
url: embedUrl,
},
);
}
});
return {
embeds,
};
};
export const warezcdnScraper = makeSourcerer({ export const warezcdnScraper = makeSourcerer({
id: 'warezcdn', id: 'warezcdn',
name: 'WarezCDN', name: 'WarezCDN',
rank: 81, rank: 81,
flags: [], flags: [flags.CORS_ALLOWED],
scrapeMovie: universalScraper, scrapeMovie: async (ctx) => {
scrapeShow: universalScraper, if (!ctx.media.imdbId) throw new NotFoundError('This source requires IMDB id.');
const serversPage = await ctx.proxiedFetcher<string>(`/filme/${ctx.media.imdbId}`, {
baseUrl: warezcdnBase,
});
const $ = load(serversPage);
const embedsHost = $('.hostList.active [data-load-embed]').get();
const embeds: SourcererEmbed[] = [];
embedsHost.forEach(async (element) => {
const embedHost = $(element).attr('data-load-embed-host')!;
const embedUrl = $(element).attr('data-load-embed')!;
if (embedHost === 'mixdrop') {
const realEmbedUrl = await getExternalPlayerUrl(ctx, 'mixdrop', embedUrl);
if (!realEmbedUrl) throw new Error('Could not find embed url');
embeds.push({
embedId: mixdropScraper.id,
url: realEmbedUrl,
});
} else if (embedHost === 'warezcdn') {
embeds.push(
{
embedId: warezcdnembedHlsScraper.id,
url: embedUrl,
},
{
embedId: warezcdnembedMp4Scraper.id,
url: embedUrl,
},
);
}
});
return {
embeds,
};
},
scrapeShow: async (ctx) => {
if (!ctx.media.imdbId) throw new NotFoundError('This source requires IMDB id.');
const url = `${warezcdnBase}/serie/${ctx.media.imdbId}/${ctx.media.season.number}/${ctx.media.episode.number}`;
const serversPage = await ctx.proxiedFetcher<string>(url);
const episodeId = serversPage.match(/\$\('\[data-load-episode-content="(\d+)"\]'\)/)?.[1];
if (!episodeId) throw new NotFoundError('Failed to find episode id');
const streamsData = await ctx.proxiedFetcher<string>(`/serieAjax.php`, {
method: 'POST',
baseUrl: warezcdnBase,
body: new URLSearchParams({
getAudios: episodeId,
}),
headers: {
Origin: warezcdnBase,
Referer: url,
'X-Requested-With': 'XMLHttpRequest',
},
});
const streams: SerieAjaxResponse = JSON.parse(streamsData);
const list = streams.list['0'];
const embeds: SourcererEmbed[] = [];
// 3 means ok
if (list.mixdropStatus === '3') {
const realEmbedUrl = await getExternalPlayerUrl(ctx, 'mixdrop', list.id);
if (!realEmbedUrl) throw new Error('Could not find embed url');
embeds.push({
embedId: mixdropScraper.id,
url: realEmbedUrl,
});
}
if (list.warezcdnStatus === '3') {
embeds.push(
{
embedId: warezcdnembedHlsScraper.id,
url: list.id,
},
{
embedId: warezcdnembedMp4Scraper.id,
url: list.id,
},
);
}
return {
embeds,
};
},
}); });

View File

@@ -0,0 +1,16 @@
interface Data {
id: string;
audio: string;
mixdropStatus: string;
fembedStatus: string;
streamtapeStatus: string;
warezcdnStatus: string;
}
type List = {
[key: string]: Data;
};
export interface SerieAjaxResponse {
list: List;
}

View File

@@ -71,7 +71,7 @@ export async function scrapeInvidualSource(
// only check for playable streams if there are streams, and if there are no embeds // only check for playable streams if there are streams, and if there are no embeds
if (output.stream && output.stream.length > 0 && output.embeds.length === 0) { if (output.stream && output.stream.length > 0 && output.embeds.length === 0) {
const playableStreams = await validatePlayableStreams(output.stream, ops); const playableStreams = await validatePlayableStreams(output.stream, ops, sourceScraper.id);
if (playableStreams.length === 0) throw new NotFoundError('No playable streams found'); if (playableStreams.length === 0) throw new NotFoundError('No playable streams found');
output.stream = playableStreams; output.stream = playableStreams;
} }
@@ -112,7 +112,7 @@ export async function scrapeIndividualEmbed(
.filter((stream) => flagsAllowedInFeatures(ops.features, stream.flags)); .filter((stream) => flagsAllowedInFeatures(ops.features, stream.flags));
if (output.stream.length === 0) throw new NotFoundError('No streams found'); if (output.stream.length === 0) throw new NotFoundError('No streams found');
const playableStreams = await validatePlayableStreams(output.stream, ops); const playableStreams = await validatePlayableStreams(output.stream, ops, embedScraper.id);
if (playableStreams.length === 0) throw new NotFoundError('No playable streams found'); if (playableStreams.length === 0) throw new NotFoundError('No playable streams found');
output.stream = playableStreams; output.stream = playableStreams;

View File

@@ -104,7 +104,7 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
// return stream is there are any // return stream is there are any
if (output.stream?.[0]) { if (output.stream?.[0]) {
const playableStream = await validatePlayableStream(output.stream[0], ops); const playableStream = await validatePlayableStream(output.stream[0], ops, source.id);
if (!playableStream) throw new NotFoundError('No streams found'); if (!playableStream) throw new NotFoundError('No streams found');
return { return {
sourceId: source.id, sourceId: source.id,
@@ -151,7 +151,7 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
if (embedOutput.stream.length === 0) { if (embedOutput.stream.length === 0) {
throw new NotFoundError('No streams found'); throw new NotFoundError('No streams found');
} }
const playableStream = await validatePlayableStream(embedOutput.stream[0], ops); const playableStream = await validatePlayableStream(embedOutput.stream[0], ops, embed.embedId);
if (!playableStream) throw new NotFoundError('No streams found'); if (!playableStream) throw new NotFoundError('No streams found');
embedOutput.stream = [playableStream]; embedOutput.stream = [playableStream];
} catch (error) { } catch (error) {

View File

@@ -1,7 +1,10 @@
import { warezcdnembedMp4Scraper } from '@/providers/embeds/warezcdn/mp4';
import { Stream } from '@/providers/streams'; import { Stream } from '@/providers/streams';
import { IndividualEmbedRunnerOptions } from '@/runners/individualRunner'; import { IndividualEmbedRunnerOptions } from '@/runners/individualRunner';
import { ProviderRunnerOptions } from '@/runners/runner'; import { ProviderRunnerOptions } from '@/runners/runner';
const SKIP_VALIDATION_CHECK_IDS = [warezcdnembedMp4Scraper.id];
export function isValidStream(stream: Stream | undefined): boolean { export function isValidStream(stream: Stream | undefined): boolean {
if (!stream) return false; if (!stream) return false;
if (stream.type === 'hls') { if (stream.type === 'hls') {
@@ -21,7 +24,10 @@ export function isValidStream(stream: Stream | undefined): boolean {
export async function validatePlayableStream( export async function validatePlayableStream(
stream: Stream, stream: Stream,
ops: ProviderRunnerOptions | IndividualEmbedRunnerOptions, ops: ProviderRunnerOptions | IndividualEmbedRunnerOptions,
sourcererId: string,
): Promise<Stream | null> { ): Promise<Stream | null> {
if (SKIP_VALIDATION_CHECK_IDS.includes(sourcererId)) return stream;
if (stream.type === 'hls') { if (stream.type === 'hls') {
const result = await ops.proxiedFetcher.full(stream.playlist, { const result = await ops.proxiedFetcher.full(stream.playlist, {
method: 'GET', method: 'GET',
@@ -63,8 +69,11 @@ export async function validatePlayableStream(
export async function validatePlayableStreams( export async function validatePlayableStreams(
streams: Stream[], streams: Stream[],
ops: ProviderRunnerOptions | IndividualEmbedRunnerOptions, ops: ProviderRunnerOptions | IndividualEmbedRunnerOptions,
sourcererId: string,
): Promise<Stream[]> { ): Promise<Stream[]> {
return (await Promise.all(streams.map((stream) => validatePlayableStream(stream, ops)))).filter( if (SKIP_VALIDATION_CHECK_IDS.includes(sourcererId)) return streams;
return (await Promise.all(streams.map((stream) => validatePlayableStream(stream, ops, sourcererId)))).filter(
(v) => v !== null, (v) => v !== null,
) as Stream[]; ) as Stream[];
} }