mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 12:43:25 +00:00
Add insertunit
This commit is contained in:
@@ -11,6 +11,7 @@ import { upstreamScraper } from '@/providers/embeds/upstream';
|
|||||||
import { vidsrcembedScraper } from '@/providers/embeds/vidsrc';
|
import { vidsrcembedScraper } from '@/providers/embeds/vidsrc';
|
||||||
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';
|
||||||
@@ -55,6 +56,7 @@ export function gatherAllSources(): Array<Sourcerer> {
|
|||||||
goojaraScraper,
|
goojaraScraper,
|
||||||
hdRezkaScraper,
|
hdRezkaScraper,
|
||||||
primewireScraper,
|
primewireScraper,
|
||||||
|
insertunitScraper,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
72
src/providers/sources/insertunit.ts
Normal file
72
src/providers/sources/insertunit.ts
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
import { flags } from '@/entrypoint/utils/targets';
|
||||||
|
import { makeSourcerer } from '@/providers/base';
|
||||||
|
import { NotFoundError } from '@/utils/errors';
|
||||||
|
|
||||||
|
const insertunitbase = 'https://api.insertunit.ws/';
|
||||||
|
|
||||||
|
export const insertunitScraper = makeSourcerer({
|
||||||
|
id: 'insertunit',
|
||||||
|
name: 'Insert Unit',
|
||||||
|
disabled: false,
|
||||||
|
rank: 60,
|
||||||
|
flags: [flags.CORS_ALLOWED],
|
||||||
|
async scrapeShow(ctx) {
|
||||||
|
const playerData = await ctx.fetcher(`${insertunitbase}/embed/imdb/${ctx.media.imdbId}`);
|
||||||
|
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 = JSON.parse(seasonData[1]);
|
||||||
|
for (const season of seasonTable) {
|
||||||
|
if (season.season === ctx.media.season.number) {
|
||||||
|
if (season.episodes[ctx.media.episode.number] && season.episodes[ctx.media.episode.number].hls) {
|
||||||
|
return {
|
||||||
|
embeds: [],
|
||||||
|
stream: [
|
||||||
|
{
|
||||||
|
id: 'primary',
|
||||||
|
captions: [],
|
||||||
|
playlist: season.episodes[ctx.media.episode.number].hls,
|
||||||
|
type: 'hls',
|
||||||
|
flags: [flags.CORS_ALLOWED],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new NotFoundError('No result found');
|
||||||
|
},
|
||||||
|
async scrapeMovie(ctx) {
|
||||||
|
const playerData = await ctx.fetcher(`${insertunitbase}/embed/imdb/${ctx.media.imdbId}`);
|
||||||
|
ctx.progress(50);
|
||||||
|
|
||||||
|
const streamRegex = /hls: "([^"]*)/;
|
||||||
|
const streamData = streamRegex.exec(playerData);
|
||||||
|
|
||||||
|
if (streamData === null || streamData[1] === null) {
|
||||||
|
throw new NotFoundError('No result found');
|
||||||
|
}
|
||||||
|
ctx.progress(90);
|
||||||
|
|
||||||
|
return {
|
||||||
|
embeds: [],
|
||||||
|
stream: [
|
||||||
|
{
|
||||||
|
id: 'primary',
|
||||||
|
type: 'hls',
|
||||||
|
playlist: streamData[1],
|
||||||
|
flags: [flags.CORS_ALLOWED],
|
||||||
|
captions: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
Reference in New Issue
Block a user