mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 15:43:26 +00:00
Added Base URL Declaration
This commit is contained in:
@@ -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<EmbedsResult> {
|
||||
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<EmbedsR
|
||||
const embedRedirectURLs = $('a')
|
||||
.map((index, element) => $(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<EmbedsR
|
||||
.full(url, {
|
||||
headers: {
|
||||
cookie: `aGooz=${aGoozCookie}; ${RandomCookieName}=${RandomCookieValue};`,
|
||||
Referer: 'https://ww1.goojara.to/eJwD5z',
|
||||
Referer: baseUrl2,
|
||||
},
|
||||
method: 'GET',
|
||||
})
|
||||
|
@@ -1,3 +1,7 @@
|
||||
export const baseUrl = 'https://www.goojara.to';
|
||||
|
||||
export const baseUrl2 = 'https://ww1.goojara.to';
|
||||
|
||||
export type EmbedsResult = { embedId: string; url: string }[];
|
||||
|
||||
export interface Result {
|
||||
|
@@ -7,7 +7,7 @@ import { ScrapeContext } from '@/utils/context';
|
||||
import { NotFoundError } from '@/utils/errors';
|
||||
|
||||
import { getEmbeds } from './getEmbeds';
|
||||
import { EmbedsResult, Result } from './type';
|
||||
import { EmbedsResult, Result, baseUrl } from './type';
|
||||
|
||||
let data;
|
||||
|
||||
@@ -23,7 +23,7 @@ export async function searchAndFindMedia(
|
||||
media: MovieMedia | ShowMedia,
|
||||
): Promise<Result | undefined> {
|
||||
data = await ctx.fetcher<string>(`/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<string>(`/${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<string>(`/xhrc.php`, {
|
||||
baseUrl: 'https://ww1.goojara.to',
|
||||
baseUrl,
|
||||
headers: headersData,
|
||||
method: 'POST',
|
||||
body: new URLSearchParams({ s: media.season.number.toString(), t: dataId }),
|
||||
|
Reference in New Issue
Block a user