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

View File

@@ -1,8 +1,9 @@
import { makeEmbed } from '@/providers/base';
import { warezcdnWorkerProxy } from '@/providers/sources/warezcdn/common';
import { EmbedScrapeContext } from '@/utils/context';
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];

View File

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