mirror of
https://github.com/sussy-code/providers.git
synced 2026-04-05 17:31:17 +00:00
Add context progress calls for catflix
This commit is contained in:
parent
d2233481c2
commit
837a6da0b4
2 changed files with 14 additions and 0 deletions
|
|
@ -22,6 +22,8 @@ export const turbovidScraper = makeEmbed({
|
|||
const baseUrl = new URL(ctx.url).origin;
|
||||
const embedPage = await ctx.proxiedFetcher(ctx.url);
|
||||
|
||||
ctx.progress(30);
|
||||
|
||||
// the whitespace is for future-proofing the regex a bit
|
||||
const apkey = embedPage.match(/const\s+apkey\s*=\s*"(.*?)";/)?.[1];
|
||||
const xxid = embedPage.match(/const\s+xxid\s*=\s*"(.*?)";/)?.[1];
|
||||
|
|
@ -40,6 +42,8 @@ export const turbovidScraper = makeEmbed({
|
|||
|
||||
if (!juiceKey) throw new Error('Failed to fetch the key');
|
||||
|
||||
ctx.progress(60);
|
||||
|
||||
const data = JSON.parse(
|
||||
await ctx.proxiedFetcher('/api/cucked/the_juice/', {
|
||||
baseUrl,
|
||||
|
|
@ -54,6 +58,8 @@ export const turbovidScraper = makeEmbed({
|
|||
|
||||
if (!data) throw new Error('Failed to fetch required data');
|
||||
|
||||
ctx.progress(90);
|
||||
|
||||
const playlist = decrypt(data, juiceKey);
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
},
|
||||
});
|
||||
|
||||
ctx.progress(40);
|
||||
|
||||
const $search = load(searchPage);
|
||||
const searchResults: { title: string; year?: number | undefined; url: string }[] = [];
|
||||
|
||||
|
|
@ -32,6 +34,8 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
let watchPageUrl = searchResults.find((x) => x && compareMedia(ctx.media, x.title, x.year))?.url;
|
||||
if (!watchPageUrl) throw new NotFoundError('No watchable item found');
|
||||
|
||||
ctx.progress(60);
|
||||
|
||||
if (ctx.media.type === 'show') {
|
||||
const match = watchPageUrl.match(/\/series\/([^/]+)\/?/);
|
||||
if (!match) throw new Error('Failed to parse watch page url');
|
||||
|
|
@ -43,9 +47,13 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
|
||||
const watchPage = load(await ctx.proxiedFetcher(watchPageUrl));
|
||||
|
||||
ctx.progress(80);
|
||||
|
||||
const url = watchPage('iframe').first().attr('src'); // I couldn't think of a better way
|
||||
if (!url) throw new Error('Failed to find embed url');
|
||||
|
||||
ctx.progress(90);
|
||||
|
||||
return {
|
||||
embeds: [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue