complete requested changes

This commit is contained in:
lonelil
2024-04-11 22:06:53 +08:00
parent 3f68b00ffa
commit cffbc844e0
4 changed files with 14 additions and 10 deletions

View File

@@ -23,7 +23,7 @@ function decrypt(input: string) {
} }
export async function getDecryptedId(ctx: EmbedScrapeContext) { export async function getDecryptedId(ctx: EmbedScrapeContext) {
const page = await ctx.proxiedFetcher<string>(`/player.php?${new URLSearchParams({ id: ctx.url })}`, { const page = await ctx.proxiedFetcher<string>(`/player.php`, {
baseUrl: warezcdnPlayerBase, baseUrl: warezcdnPlayerBase,
headers: { headers: {
Referer: `${warezcdnPlayerBase}/getEmbed.php?${new URLSearchParams({ Referer: `${warezcdnPlayerBase}/getEmbed.php?${new URLSearchParams({
@@ -31,6 +31,9 @@ export async function getDecryptedId(ctx: EmbedScrapeContext) {
sv: 'warezcdn', sv: 'warezcdn',
})}`, })}`,
}, },
query: {
id: ctx.url,
},
}); });
const allowanceKey = page.match(/let allowanceKey = "(.*?)";/)?.[1]; const allowanceKey = page.match(/let allowanceKey = "(.*?)";/)?.[1];
if (!allowanceKey) throw new NotFoundError('Failed to get allowanceKey'); if (!allowanceKey) throw new NotFoundError('Failed to get allowanceKey');
@@ -53,5 +56,3 @@ export async function getDecryptedId(ctx: EmbedScrapeContext) {
return decryptedId; return decryptedId;
} }
export const warezcdnWorkerProxy = 'https://workerproxy.warezcdn.workers.dev';

View File

@@ -1,8 +1,9 @@
import { makeEmbed } from '@/providers/base'; import { makeEmbed } from '@/providers/base';
import { warezcdnWorkerProxy } from '@/providers/sources/warezcdn/common';
import { EmbedScrapeContext } from '@/utils/context'; import { EmbedScrapeContext } from '@/utils/context';
import { NotFoundError } from '@/utils/errors'; import { NotFoundError } from '@/utils/errors';
import { getDecryptedId, warezcdnWorkerProxy } from './common'; import { getDecryptedId } from './common';
const cdnListing = [50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64]; const cdnListing = [50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64];

View File

@@ -1,3 +1,4 @@
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';

View File

@@ -1,6 +1,6 @@
import { load } from 'cheerio'; import { load } from 'cheerio';
import { SourcererEmbed, SourcererOutput, 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';
@@ -30,15 +30,16 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
const embedUrl = $(element).attr('data-load-embed')!; const embedUrl = $(element).attr('data-load-embed')!;
if (embedHost === 'mixdrop') { if (embedHost === 'mixdrop') {
const params = new URLSearchParams({ const params = {
id: embedUrl, id: embedUrl,
sv: 'mixdrop', sv: 'mixdrop',
}); };
const realUrl = await ctx.proxiedFetcher<string>(`/getPlay.php?${params}`, { const realUrl = await ctx.proxiedFetcher<string>(`/getPlay.php`, {
baseUrl: warezcdnApiBase, baseUrl: warezcdnApiBase,
headers: { headers: {
Referer: `${warezcdnApiBase}/getEmbed.php?${params}`, Referer: `${warezcdnApiBase}/getEmbed.php?${new URLSearchParams(params)}`,
}, },
query: params,
}); });
const realEmbedUrl = realUrl.match(/window\.location\.href="([^"]*)";/); const realEmbedUrl = realUrl.match(/window\.location\.href="([^"]*)";/);
@@ -63,7 +64,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
return { return {
embeds, embeds,
} as SourcererOutput; };
}; };
export const warezcdnScraper = makeSourcerer({ export const warezcdnScraper = makeSourcerer({