Add warezplayer embed
This commit is contained in:
parent
d52dd3dd49
commit
9b9fbc625f
|
@ -55,6 +55,7 @@ import { vidplayScraper } from './embeds/vidplay';
|
|||
import { voeScraper } from './embeds/voe';
|
||||
import { warezcdnembedHlsScraper } from './embeds/warezcdn/hls';
|
||||
import { warezcdnembedMp4Scraper } from './embeds/warezcdn/mp4';
|
||||
import { warezPlayerScraper } from './embeds/warezcdn/warezplayer';
|
||||
import { wootlyScraper } from './embeds/wootly';
|
||||
import { goojaraScraper } from './sources/goojara';
|
||||
import { hdRezkaScraper } from './sources/hdrezka';
|
||||
|
@ -133,6 +134,7 @@ export function gatherAllEmbeds(): Array<Embed> {
|
|||
vTubeScraper,
|
||||
warezcdnembedHlsScraper,
|
||||
warezcdnembedMp4Scraper,
|
||||
warezPlayerScraper,
|
||||
bflixScraper,
|
||||
playm4uNMScraper,
|
||||
hydraxScraper,
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
import { makeEmbed } from '@/providers/base';
|
||||
import { warezcdnApiBase, warezcdnPlayerBase } from '@/providers/sources/warezcdn/common';
|
||||
|
||||
export const warezPlayerScraper = makeEmbed({
|
||||
id: 'warezplayer',
|
||||
name: 'warezPLAYER',
|
||||
rank: 85,
|
||||
async scrape(ctx) {
|
||||
const page = await ctx.proxiedFetcher.full<string>(`/player.php`, {
|
||||
baseUrl: warezcdnPlayerBase,
|
||||
headers: {
|
||||
Referer: `${warezcdnApiBase}/getEmbed.php?${new URLSearchParams({
|
||||
id: ctx.url,
|
||||
sv: 'warezcdn',
|
||||
})}`,
|
||||
},
|
||||
query: {
|
||||
id: ctx.url,
|
||||
},
|
||||
});
|
||||
// ex url: https://basseqwevewcewcewecwcw.xyz/video/0e4a2c65bdaddd66a53422d93daebe68
|
||||
const playerPageUrl = new URL(page.finalUrl);
|
||||
|
||||
const hash = playerPageUrl.pathname.split('/')[2];
|
||||
const playerApiRes = await ctx.proxiedFetcher('/player/index.php', {
|
||||
baseUrl: playerPageUrl.origin,
|
||||
query: {
|
||||
data: hash,
|
||||
do: 'getVideo',
|
||||
},
|
||||
method: 'POST',
|
||||
body: new URLSearchParams({
|
||||
hash,
|
||||
}),
|
||||
headers: {
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
},
|
||||
});
|
||||
const sources = JSON.parse(playerApiRes); // json isn't parsed by fetcher due to content-type being text/html.
|
||||
if (!sources.videoSource) throw new Error('Playlist not found');
|
||||
|
||||
return {
|
||||
stream: [
|
||||
{
|
||||
id: 'primary',
|
||||
type: 'hls',
|
||||
flags: [],
|
||||
captions: [],
|
||||
playlist: sources.videoSource,
|
||||
headers: {
|
||||
// without this it returns "security error"
|
||||
Accept: '*/*',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
});
|
|
@ -5,6 +5,7 @@ import { SourcererEmbed, makeSourcerer } from '@/providers/base';
|
|||
import { mixdropScraper } from '@/providers/embeds/mixdrop';
|
||||
import { warezcdnembedHlsScraper } from '@/providers/embeds/warezcdn/hls';
|
||||
import { warezcdnembedMp4Scraper } from '@/providers/embeds/warezcdn/mp4';
|
||||
import { warezPlayerScraper } from '@/providers/embeds/warezcdn/warezplayer';
|
||||
import { NotFoundError } from '@/utils/errors';
|
||||
|
||||
import { getExternalPlayerUrl, warezcdnBase } from './common';
|
||||
|
@ -48,6 +49,10 @@ export const warezcdnScraper = makeSourcerer({
|
|||
embedId: warezcdnembedMp4Scraper.id,
|
||||
url: embedUrl,
|
||||
},
|
||||
{
|
||||
embedId: warezPlayerScraper.id,
|
||||
url: embedUrl,
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue