add ctx.progress to sources

This commit is contained in:
Pas 2025-01-19 14:27:34 -07:00
parent 5fae2581ba
commit b28a0ce074
10 changed files with 24 additions and 0 deletions

View file

@ -19,6 +19,7 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
const fileDataMatch = playerPage.match(/"file": (\[.*?\])/s);
if (!fileDataMatch[1]) throw new NotFoundError('No data found');
ctx.progress(50);
const fileData: { title: string; file: string }[] = JSON.parse(fileDataMatch[1].replace(/,\s*\]$/, ']'));
@ -29,6 +30,7 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
if (!url) continue;
embeds.push({ embedId: `autoembed-${stream.title.toLowerCase().trim()}`, url });
}
ctx.progress(90);
return {
embeds,

View file

@ -28,6 +28,7 @@ async function comboScraper(ctx: MovieScrapeContext): Promise<SourcererOutput> {
const id = search.find((v) => v && compareMedia(ctx.media, v.title, v.year))?.id;
if (!id) throw new NotFoundError('No watchable item found');
ctx.progress(20);
const details: itemDetails = JSON.parse(
await ctx.proxiedFetcher<string>('/get', {
@ -40,6 +41,7 @@ async function comboScraper(ctx: MovieScrapeContext): Promise<SourcererOutput> {
}),
);
if (!details.message.video) throw new Error('Failed to get the stream');
ctx.progress(40);
const keyParams: renewResponse = JSON.parse(
await ctx.proxiedFetcher<string>('/renew', {
@ -51,6 +53,7 @@ async function comboScraper(ctx: MovieScrapeContext): Promise<SourcererOutput> {
}),
);
if (!keyParams.k) throw new Error('Failed to get the key');
ctx.progress(60);
const server = details.message.server === '1' ? 'https://vid.ee3.me/vid/' : 'https://vault.rips.cc/video/';
const k = keyParams.k;
@ -67,6 +70,7 @@ async function comboScraper(ctx: MovieScrapeContext): Promise<SourcererOutput> {
language: 'en',
});
}
ctx.progress(90);
return {
embeds: [],

View file

@ -34,6 +34,7 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
const watchPageUrl = searchResults.find((x) => x && compareMedia(ctx.media, x.title, x.year))?.url;
if (!watchPageUrl) throw new NotFoundError('No watchable item found');
ctx.progress(50);
const watchPage = await ctx.proxiedFetcher(watchPageUrl.replace('/movie', '/w'), { baseUrl });
@ -67,6 +68,7 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
},
{} as FileBasedStream['qualities'],
);
ctx.progress(90);
return {
embeds: [],

View file

@ -102,6 +102,7 @@ const universalScraper = async (ctx: ShowScrapeContext | MovieScrapeContext): Pr
const { url: streamUrl, subtitle: streamSubtitle } = await getStream(result.id, translatorId, ctx);
const parsedVideos = parseVideoLinks(streamUrl);
const parsedSubtitles = parseSubtitleLinks(streamSubtitle);
ctx.progress(90);
return {
embeds: [],

View file

@ -37,6 +37,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
if (ctx.media.type === 'show') {
videoUrl = `${show.url}/season/${ctx.media.season.number}/episode/${ctx.media.episode.number}`;
}
ctx.progress(50);
const videoPage = await ctx.proxiedFetcher<string>(videoUrl, {
baseUrl: nepuBase,
@ -55,6 +56,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
const streamUrl = playerPage.match(/"file":"([^"]+)"/);
if (!streamUrl?.[1]) throw new NotFoundError('No stream found.');
ctx.progress(90);
return {
embeds: [],

View file

@ -26,6 +26,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
});
const targetMedia = mediaData.find((m) => m.name === ctx.media.title && m.year === ctx.media.releaseYear.toString());
if (!targetMedia?.fullSlug) throw new NotFoundError('No watchable item found');
ctx.progress(40);
let iframeSourceUrl = `/${targetMedia.fullSlug}/videos`;
@ -51,6 +52,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
const iframeSource$ = load(iframeSource.data[0].url);
const iframeUrl = iframeSource$('iframe').attr('data-src');
if (!iframeUrl) throw new NotFoundError('No watchable item found');
ctx.progress(60);
const embeds: SourcererEmbed[] = [];
if (iframeUrl.includes('closeload')) {
@ -65,6 +67,8 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
url: iframeUrl,
});
}
ctx.progress(90);
return {
embeds,
};

View file

@ -57,6 +57,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext): Pr
const pass = contentPage$('#hId').attr('value');
if (!pass) throw new NotFoundError('Content not found');
ctx.progress(50);
const formData = new URLSearchParams();
formData.append('pass', pass);
@ -96,6 +97,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext): Pr
language,
});
}
ctx.progress(90);
return {
embeds: [],

View file

@ -25,6 +25,7 @@ export const tugaflixScraper = makeSourcerer({
const url = searchResults.find((x) => x && compareMedia(ctx.media, x.title, x.year))?.url;
if (!url) throw new NotFoundError('No watchable item found');
ctx.progress(50);
const videoPage = await ctx.proxiedFetcher<string>(url, {
method: 'POST',
@ -59,6 +60,7 @@ export const tugaflixScraper = makeSourcerer({
});
}
}
ctx.progress(90);
return {
embeds,
@ -77,6 +79,7 @@ export const tugaflixScraper = makeSourcerer({
const url = searchResults.find((x) => x && compareMedia(ctx.media, x.title, x.year))?.url;
if (!url) throw new NotFoundError('No watchable item found');
ctx.progress(50);
const s = ctx.media.season.number < 10 ? `0${ctx.media.season.number}` : ctx.media.season.number.toString();
const e = ctx.media.episode.number < 10 ? `0${ctx.media.episode.number}` : ctx.media.episode.number.toString();
@ -108,6 +111,7 @@ export const tugaflixScraper = makeSourcerer({
url: finalUrl,
});
}
ctx.progress(90);
return {
embeds,

View file

@ -26,6 +26,7 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
.map((x) => x[2]);
if (!servers[0]) throw new NotFoundError('No flixhq playlist found');
ctx.progress(60);
return {
embeds: [],

View file

@ -57,6 +57,7 @@ export const warezcdnScraper = makeSourcerer({
const [, id, servers] = serversPage.match(/let\s+data\s*=\s*'\[\s*\{\s*"id":"([^"]+)".*?"servers":"([^"]+)"/)!;
if (!id || !servers) throw new NotFoundError('Failed to find episode id');
ctx.progress(40);
return getEmbeds(id, servers, ctx);
},
@ -67,6 +68,7 @@ export const warezcdnScraper = makeSourcerer({
const seasonsApi = serversPage.match(/var\s+cachedSeasons\s*=\s*"([^"]+)"/)?.[1];
if (!seasonsApi) throw new NotFoundError('Failed to find data');
ctx.progress(40);
const streamsData = await ctx.proxiedFetcher<cachedSeasonsRes>(seasonsApi, {
baseUrl: warezcdnBase,