From d6624efc5a42b77a0b1d3d53a1294ed704d079fa Mon Sep 17 00:00:00 2001 From: MemeCornucopia <148788549+MemeCornucopia@users.noreply.github.com> Date: Sun, 28 Jan 2024 14:27:07 -0500 Subject: [PATCH] Added Base URL Declaration --- src/providers/sources/goojara/getEmbeds.ts | 10 +++++----- src/providers/sources/goojara/type.ts | 4 ++++ src/providers/sources/goojara/util.ts | 8 ++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/providers/sources/goojara/getEmbeds.ts b/src/providers/sources/goojara/getEmbeds.ts index de2148a..33b7e16 100644 --- a/src/providers/sources/goojara/getEmbeds.ts +++ b/src/providers/sources/goojara/getEmbeds.ts @@ -2,13 +2,13 @@ import { load } from 'cheerio'; import { ScrapeContext } from '@/utils/context'; -import { EmbedsResult } from './type'; +import { EmbedsResult, baseUrl, baseUrl2 } from './type'; export async function getEmbeds(ctx: ScrapeContext, id: string): Promise { const data = await ctx.fetcher.full(`/${id}`, { - baseUrl: 'https://ww1.goojara.to', + baseUrl: baseUrl2, headers: { - Referer: 'https://www.goojara.to/', + Referer: baseUrl, }, readHeaders: ['Set-Cookie'], method: 'GET', @@ -23,7 +23,7 @@ export async function getEmbeds(ctx: ScrapeContext, id: string): Promise $(element).attr('href')) .get() - .filter((href) => href && href.includes('https://ww1.goojara.to/go.php')); + .filter((href) => href && href.includes(`${baseUrl2}/go.php`)); const embedPages = await Promise.all( embedRedirectURLs.map( @@ -32,7 +32,7 @@ export async function getEmbeds(ctx: ScrapeContext, id: string): Promise { data = await ctx.fetcher(`/xhrr.php`, { - baseUrl: 'https://www.goojara.to', + baseUrl, headers: headersData, method: 'POST', body: new URLSearchParams({ q: media.title }), @@ -66,7 +66,7 @@ export async function scrapeIds( id = result.slug; } else if (media.type === 'show') { data = await ctx.fetcher(`/${result.slug}`, { - baseUrl: 'https://www.goojara.to', + baseUrl, headers: headersData, method: 'GET', }); @@ -78,7 +78,7 @@ export async function scrapeIds( if (!dataId) throw NotFoundError; data = await ctx.fetcher(`/xhrc.php`, { - baseUrl: 'https://ww1.goojara.to', + baseUrl, headers: headersData, method: 'POST', body: new URLSearchParams({ s: media.season.number.toString(), t: dataId }),