add types

This commit is contained in:
lonelil
2024-04-11 19:29:35 +08:00
parent c17b74c8ba
commit 9ba05ab991
3 changed files with 5 additions and 4 deletions

View File

@@ -35,7 +35,7 @@ export async function getDecryptedId(ctx: EmbedScrapeContext) {
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');
const streamData = await ctx.proxiedFetcher('/functions.php', { const streamData = await ctx.proxiedFetcher<string>('/functions.php', {
baseUrl: warezcdnPlayerBase, baseUrl: warezcdnPlayerBase,
method: 'POST', method: 'POST',
body: new URLSearchParams({ body: new URLSearchParams({

View File

@@ -7,7 +7,7 @@ import { getDecryptedId } from './common';
// Method found by atpn // Method found by atpn
async function getVideowlUrlStream(ctx: EmbedScrapeContext, decryptedId: string) { async function getVideowlUrlStream(ctx: EmbedScrapeContext, decryptedId: string) {
const sharePage = await ctx.proxiedFetcher('https://cloud.mail.ru/public/uaRH/2PYWcJRpH'); const sharePage = await ctx.proxiedFetcher<string>('https://cloud.mail.ru/public/uaRH/2PYWcJRpH');
const regex = /"videowl_view":\{"count":"(\d+)","url":"([^"]+)"\}/g; const regex = /"videowl_view":\{"count":"(\d+)","url":"([^"]+)"\}/g;
const videowlUrl = regex.exec(sharePage)?.[2]; const videowlUrl = regex.exec(sharePage)?.[2];

View File

@@ -16,7 +16,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
if (ctx.media.type === 'show') if (ctx.media.type === 'show')
id = `serie/${ctx.media.imdbId}/${ctx.media.season.number}/${ctx.media.episode.number}`; id = `serie/${ctx.media.imdbId}/${ctx.media.season.number}/${ctx.media.episode.number}`;
const serversPage = await ctx.proxiedFetcher(`/${id}`, { const serversPage = await ctx.proxiedFetcher<string>(`/${id}`, {
baseUrl: warezcdnBase, baseUrl: warezcdnBase,
}); });
const $ = load(serversPage); const $ = load(serversPage);
@@ -34,7 +34,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
id: embedUrl, id: embedUrl,
sv: 'mixdrop', sv: 'mixdrop',
}); });
const realUrl = await ctx.proxiedFetcher(`/getPlay.php?${params}`, { const realUrl = await ctx.proxiedFetcher<string>(`/getPlay.php?${params}`, {
baseUrl: warezcdnApiBase, baseUrl: warezcdnApiBase,
headers: { headers: {
Referer: `${warezcdnApiBase}/getEmbed.php?${params}`, Referer: `${warezcdnApiBase}/getEmbed.php?${params}`,
@@ -42,6 +42,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
}); });
const realEmbedUrl = realUrl.match(/window\.location\.href="([^"]*)";/); const realEmbedUrl = realUrl.match(/window\.location\.href="([^"]*)";/);
if (!realEmbedUrl) throw new Error('Could not find embed url');
embeds.push({ embeds.push({
embedId: mixdropScraper.id, embedId: mixdropScraper.id,
url: realEmbedUrl[1], url: realEmbedUrl[1],