mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 16:53:24 +00:00
provider: showbox.media
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { Embed, Sourcerer } from '@/providers/base';
|
import { Embed, Sourcerer } from '@/providers/base';
|
||||||
|
import { febBoxScraper } from '@/providers/embeds/febBox';
|
||||||
import { mp4uploadScraper } from '@/providers/embeds/mp4upload';
|
import { mp4uploadScraper } from '@/providers/embeds/mp4upload';
|
||||||
import { streamsbScraper } from '@/providers/embeds/streamsb';
|
import { streamsbScraper } from '@/providers/embeds/streamsb';
|
||||||
import { upcloudScraper } from '@/providers/embeds/upcloud';
|
import { upcloudScraper } from '@/providers/embeds/upcloud';
|
||||||
@@ -8,12 +9,14 @@ import { kissAsianScraper } from '@/providers/sources/kissasian/index';
|
|||||||
import { remotestreamScraper } from '@/providers/sources/remotestream';
|
import { remotestreamScraper } from '@/providers/sources/remotestream';
|
||||||
import { superStreamScraper } from '@/providers/sources/superstream/index';
|
import { superStreamScraper } from '@/providers/sources/superstream/index';
|
||||||
|
|
||||||
|
import { showBoxScraper } from './sources/showbox';
|
||||||
|
|
||||||
export function gatherAllSources(): Array<Sourcerer> {
|
export function gatherAllSources(): Array<Sourcerer> {
|
||||||
// all sources are gathered here
|
// all sources are gathered here
|
||||||
return [flixhqScraper, remotestreamScraper, kissAsianScraper, superStreamScraper, goMoviesScraper];
|
return [flixhqScraper, remotestreamScraper, kissAsianScraper, superStreamScraper, goMoviesScraper, showBoxScraper];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function gatherAllEmbeds(): Array<Embed> {
|
export function gatherAllEmbeds(): Array<Embed> {
|
||||||
// all embeds are gathered here
|
// all embeds are gathered here
|
||||||
return [upcloudScraper, mp4uploadScraper, streamsbScraper];
|
return [upcloudScraper, mp4uploadScraper, streamsbScraper, febBoxScraper];
|
||||||
}
|
}
|
||||||
|
58
src/providers/embeds/febBox.ts
Normal file
58
src/providers/embeds/febBox.ts
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import { flags } from '@/main/targets';
|
||||||
|
import { makeEmbed } from '@/providers/base';
|
||||||
|
import { NotFoundError } from '@/utils/errors';
|
||||||
|
|
||||||
|
const febBoxBase = `https://www.febbox.com`;
|
||||||
|
|
||||||
|
export const febBoxScraper = makeEmbed({
|
||||||
|
id: 'febBox',
|
||||||
|
name: 'FebBox',
|
||||||
|
rank: 160,
|
||||||
|
async scrape(ctx) {
|
||||||
|
const shareKey = ctx.url.split('/')[4];
|
||||||
|
const streams = await ctx.fetcher<{
|
||||||
|
data?: {
|
||||||
|
file_list?: {
|
||||||
|
fid?: string;
|
||||||
|
}[];
|
||||||
|
};
|
||||||
|
}>('/file/file_share_list', {
|
||||||
|
baseUrl: febBoxBase,
|
||||||
|
query: {
|
||||||
|
share_key: shareKey,
|
||||||
|
pwd: '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const fid = streams?.data?.file_list?.[0]?.fid;
|
||||||
|
if (!fid) throw new NotFoundError('no result found');
|
||||||
|
|
||||||
|
const formParams = new URLSearchParams();
|
||||||
|
formParams.append('fid', fid);
|
||||||
|
formParams.append('share_key', shareKey);
|
||||||
|
|
||||||
|
const player = await ctx.fetcher<string>('/file/player', {
|
||||||
|
baseUrl: febBoxBase,
|
||||||
|
body: formParams,
|
||||||
|
method: 'POST',
|
||||||
|
});
|
||||||
|
|
||||||
|
const sourcesMatch = player?.match(/var sources = (\[[^\]]+\]);/);
|
||||||
|
const qualities = sourcesMatch ? JSON.parse(sourcesMatch[0].replace('var sources = ', '').replace(';', '')) : null;
|
||||||
|
|
||||||
|
if (!qualities) throw new NotFoundError('no result found');
|
||||||
|
|
||||||
|
return {
|
||||||
|
stream: {
|
||||||
|
type: 'file',
|
||||||
|
flags: [flags.NO_CORS],
|
||||||
|
qualities: {
|
||||||
|
'360': {
|
||||||
|
type: 'mp4',
|
||||||
|
url: qualities[0].file,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
@@ -23,7 +23,7 @@ export async function getFlixhqId(ctx: ScrapeContext, media: MovieMedia | ShowMe
|
|||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
title,
|
title,
|
||||||
year: +year,
|
year: parseInt(year, 10),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
66
src/providers/sources/showbox/index.ts
Normal file
66
src/providers/sources/showbox/index.ts
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
// https://www.febbox.com/file/file_share_list?share_key=${id}&pwd= > data.file_list[0].fid
|
||||||
|
// https://www.febbox.com/file/player FORM: {hare_key} > "parse js"
|
||||||
|
|
||||||
|
import { load } from 'cheerio';
|
||||||
|
|
||||||
|
import { flags } from '@/main/targets';
|
||||||
|
import { makeSourcerer } from '@/providers/base';
|
||||||
|
import { febBoxScraper } from '@/providers/embeds/febBox';
|
||||||
|
import { compareMedia } from '@/utils/compare';
|
||||||
|
import { NotFoundError } from '@/utils/errors';
|
||||||
|
|
||||||
|
const showboxBase = `https://www.showbox.media`;
|
||||||
|
|
||||||
|
export const showBoxScraper = makeSourcerer({
|
||||||
|
id: 'showBox',
|
||||||
|
name: 'ShowBox',
|
||||||
|
rank: 20,
|
||||||
|
flags: [flags.NO_CORS],
|
||||||
|
async scrapeMovie(ctx) {
|
||||||
|
const search = await ctx.fetcher<string>('/search', {
|
||||||
|
baseUrl: showboxBase,
|
||||||
|
query: {
|
||||||
|
keyword: ctx.media.title,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const searchPage = load(search);
|
||||||
|
const result = searchPage('.film-name > a')
|
||||||
|
.toArray()
|
||||||
|
.map((el) => {
|
||||||
|
const titleContainer = el.parent?.parent;
|
||||||
|
if (!titleContainer) return;
|
||||||
|
const year = searchPage(titleContainer).find('.fdi-item').first().text();
|
||||||
|
|
||||||
|
return {
|
||||||
|
title: el.attribs.title,
|
||||||
|
path: el.attribs.href,
|
||||||
|
year: !year.includes('SS') ? parseInt(year, 10) : undefined,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.find((v) => v && compareMedia(ctx.media, v.title, v.year ? v.year : undefined));
|
||||||
|
|
||||||
|
if (!result?.path) throw new NotFoundError('no result found');
|
||||||
|
|
||||||
|
const febboxResult = await ctx.fetcher<{
|
||||||
|
data?: { link?: string };
|
||||||
|
}>('/index/share_link', {
|
||||||
|
baseUrl: showboxBase,
|
||||||
|
query: {
|
||||||
|
id: result.path.split('/')[3],
|
||||||
|
type: '1',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!febboxResult?.data?.link) throw new NotFoundError('no result found');
|
||||||
|
|
||||||
|
return {
|
||||||
|
embeds: [
|
||||||
|
{
|
||||||
|
embedId: febBoxScraper.id,
|
||||||
|
url: febboxResult.data.link,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
@@ -12,14 +12,8 @@ export function compareTitle(a: string, b: string): boolean {
|
|||||||
return normalizeTitle(a) === normalizeTitle(b);
|
return normalizeTitle(a) === normalizeTitle(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function compareMedia(media: CommonMedia, title: string, releaseYear?: number, compareYear?: boolean): boolean {
|
export function compareMedia(media: CommonMedia, title: string, releaseYear?: number): boolean {
|
||||||
// if no year is provided, count as if its the correct year
|
// if no year is provided, count as if its the correct year
|
||||||
let isSameYear: boolean;
|
const isSameYear = releaseYear === undefined ? true : media.releaseYear === releaseYear;
|
||||||
if (!compareYear) {
|
|
||||||
isSameYear = true;
|
|
||||||
} else {
|
|
||||||
isSameYear = releaseYear === undefined ? true : media.releaseYear === releaseYear;
|
|
||||||
}
|
|
||||||
|
|
||||||
return compareTitle(media.title, title) && isSameYear;
|
return compareTitle(media.title, title) && isSameYear;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user