mirror of
https://github.com/sussy-code/providers.git
synced 2026-03-11 17:55:37 +00:00
Merge branch 'dev' into ee3
This commit is contained in:
commit
98ed445fe3
5 changed files with 118 additions and 15 deletions
|
|
@ -25,6 +25,13 @@ import { tugaflixScraper } from '@/providers/sources/tugaflix';
|
|||
import { vidsrcScraper } from '@/providers/sources/vidsrc/index';
|
||||
import { zoechipScraper } from '@/providers/sources/zoechip';
|
||||
|
||||
import {
|
||||
autoembedBengaliScraper,
|
||||
autoembedEnglishScraper,
|
||||
autoembedHindiScraper,
|
||||
autoembedTamilScraper,
|
||||
autoembedTeluguScraper,
|
||||
} from './embeds/autoembed';
|
||||
import { bflixScraper } from './embeds/bflix';
|
||||
import { closeLoadScraper } from './embeds/closeload';
|
||||
import { fileMoonScraper } from './embeds/filemoon';
|
||||
|
|
@ -55,6 +62,8 @@ import { soaperTvScraper } from './sources/soapertv';
|
|||
import { vidSrcToScraper } from './sources/vidsrcto';
|
||||
import { warezcdnScraper } from './sources/warezcdn';
|
||||
|
||||
import { autoembedScraper } from '@/providers/sources/autoembed';
|
||||
|
||||
export function gatherAllSources(): Array<Sourcerer> {
|
||||
// all sources are gathered here
|
||||
return [
|
||||
|
|
@ -79,6 +88,7 @@ export function gatherAllSources(): Array<Sourcerer> {
|
|||
insertunitScraper,
|
||||
nitesScraper,
|
||||
soaperTvScraper,
|
||||
autoembedScraper,
|
||||
tugaflixScraper,
|
||||
ee3Scraper,
|
||||
];
|
||||
|
|
@ -119,5 +129,10 @@ export function gatherAllEmbeds(): Array<Embed> {
|
|||
bflixScraper,
|
||||
playm4uNMScraper,
|
||||
hydraxScraper,
|
||||
autoembedEnglishScraper,
|
||||
autoembedHindiScraper,
|
||||
autoembedBengaliScraper,
|
||||
autoembedTamilScraper,
|
||||
autoembedTeluguScraper,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
54
src/providers/embeds/autoembed.ts
Normal file
54
src/providers/embeds/autoembed.ts
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import { flags } from '@/entrypoint/utils/targets';
|
||||
import { makeEmbed } from '@/providers/base';
|
||||
|
||||
const providers = [
|
||||
{
|
||||
id: 'autoembed-english',
|
||||
rank: 10,
|
||||
},
|
||||
{
|
||||
id: 'autoembed-hindi',
|
||||
rank: 9,
|
||||
},
|
||||
{
|
||||
id: 'autoembed-tamil',
|
||||
rank: 8,
|
||||
},
|
||||
{
|
||||
id: 'autoembed-telugu',
|
||||
rank: 7,
|
||||
},
|
||||
{
|
||||
id: 'autoembed-bengali',
|
||||
rank: 6,
|
||||
},
|
||||
];
|
||||
|
||||
function embed(provider: { id: string; rank: number }) {
|
||||
return makeEmbed({
|
||||
id: provider.id,
|
||||
name: provider.id.charAt(0).toUpperCase() + provider.id.slice(1),
|
||||
rank: provider.rank,
|
||||
async scrape(ctx) {
|
||||
return {
|
||||
stream: [
|
||||
{
|
||||
id: 'primary',
|
||||
type: 'hls',
|
||||
playlist: ctx.url,
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
captions: [],
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export const [
|
||||
autoembedEnglishScraper,
|
||||
autoembedHindiScraper,
|
||||
autoembedBengaliScraper,
|
||||
autoembedTamilScraper,
|
||||
autoembedTeluguScraper,
|
||||
] = providers.map(embed);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { EmbedOutput, makeEmbed } from '@/providers/base';
|
||||
import { baseUrl, headers } from '@/providers/sources/nsbx';
|
||||
import { baseUrl } from '@/providers/sources/nsbx';
|
||||
import { NotFoundError } from '@/utils/errors';
|
||||
|
||||
const providers = [
|
||||
|
|
@ -20,9 +20,8 @@ function embed(provider: { id: string; rank: number }) {
|
|||
rank: provider.rank,
|
||||
disabled: false,
|
||||
async scrape(ctx) {
|
||||
const search = await ctx.fetcher.full(
|
||||
const search = await ctx.proxiedFetcher.full(
|
||||
`${baseUrl}/search?query=${encodeURIComponent(ctx.url)}&provider=${provider.id}`,
|
||||
{ headers },
|
||||
);
|
||||
|
||||
if (search.statusCode === 429) {
|
||||
|
|
@ -33,11 +32,8 @@ function embed(provider: { id: string; rank: number }) {
|
|||
|
||||
ctx.progress(50);
|
||||
|
||||
const result = await ctx.fetcher(
|
||||
const result = await ctx.proxiedFetcher(
|
||||
`${baseUrl}/provider?resourceId=${encodeURIComponent(search.body.url)}&provider=${provider.id}`,
|
||||
{
|
||||
headers,
|
||||
},
|
||||
);
|
||||
|
||||
ctx.progress(100);
|
||||
|
|
|
|||
45
src/providers/sources/autoembed.ts
Normal file
45
src/providers/sources/autoembed.ts
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import { flags } from '@/entrypoint/utils/targets';
|
||||
import { SourcererEmbed, SourcererOutput, makeSourcerer } from '@/providers/base';
|
||||
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
||||
import { NotFoundError } from '@/utils/errors';
|
||||
|
||||
const baseUrl = 'https://autoembed.cc/';
|
||||
|
||||
async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> {
|
||||
const playerPage = await ctx.proxiedFetcher(`/embed/player.php`, {
|
||||
baseUrl,
|
||||
query: {
|
||||
id: ctx.media.tmdbId,
|
||||
...(ctx.media.type === 'show' && {
|
||||
s: ctx.media.season.number.toString(),
|
||||
e: ctx.media.episode.number.toString(),
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
const fileDataMatch = playerPage.match(/"file": (\[.*?\])/s);
|
||||
if (!fileDataMatch[1]) throw new NotFoundError('No data found');
|
||||
|
||||
const fileData: { title: string; file: string }[] = JSON.parse(fileDataMatch[1].replace(/,\s*\]$/, ']'));
|
||||
|
||||
const embeds: SourcererEmbed[] = [];
|
||||
|
||||
for (const stream of fileData) {
|
||||
const url = stream.file;
|
||||
if (!url) continue;
|
||||
embeds.push({ embedId: `autoembed-${stream.title.toLowerCase().trim()}`, url });
|
||||
}
|
||||
|
||||
return {
|
||||
embeds,
|
||||
};
|
||||
}
|
||||
|
||||
export const autoembedScraper = makeSourcerer({
|
||||
id: 'autoembed',
|
||||
name: 'Autoembed',
|
||||
rank: 10,
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
scrapeMovie: comboScraper,
|
||||
scrapeShow: comboScraper,
|
||||
});
|
||||
|
|
@ -5,11 +5,6 @@ import { NotFoundError } from '@/utils/errors';
|
|||
|
||||
export const baseUrl = 'https://api.nsbx.ru';
|
||||
|
||||
export const headers = {
|
||||
Origin: 'https://extension.works.again.with.nsbx',
|
||||
Referer: 'https://extension.works.again.with.nsbx',
|
||||
};
|
||||
|
||||
async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> {
|
||||
const query = {
|
||||
title: ctx.media.title,
|
||||
|
|
@ -26,9 +21,7 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
query.episode = ctx.media.episode.number.toString();
|
||||
}
|
||||
|
||||
const res = await ctx.fetcher(`${baseUrl}/status`, {
|
||||
headers,
|
||||
});
|
||||
const res = await ctx.proxiedFetcher(`${baseUrl}/status`);
|
||||
|
||||
if (res.providers?.length === 0) {
|
||||
throw new NotFoundError('No providers available');
|
||||
|
|
|
|||
Loading…
Reference in a new issue