mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 12:43:25 +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 { ScrapeContext } from '@/utils/context';
|
||||||
|
|
||||||
import { EmbedsResult } from './type';
|
import { EmbedsResult, baseUrl, baseUrl2 } from './type';
|
||||||
|
|
||||||
export async function getEmbeds(ctx: ScrapeContext, id: string): Promise<EmbedsResult> {
|
export async function getEmbeds(ctx: ScrapeContext, id: string): Promise<EmbedsResult> {
|
||||||
const data = await ctx.fetcher.full(`/${id}`, {
|
const data = await ctx.fetcher.full(`/${id}`, {
|
||||||
baseUrl: 'https://ww1.goojara.to',
|
baseUrl: baseUrl2,
|
||||||
headers: {
|
headers: {
|
||||||
Referer: 'https://www.goojara.to/',
|
Referer: baseUrl,
|
||||||
},
|
},
|
||||||
readHeaders: ['Set-Cookie'],
|
readHeaders: ['Set-Cookie'],
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@@ -23,7 +23,7 @@ export async function getEmbeds(ctx: ScrapeContext, id: string): Promise<EmbedsR
|
|||||||
const embedRedirectURLs = $('a')
|
const embedRedirectURLs = $('a')
|
||||||
.map((index, element) => $(element).attr('href'))
|
.map((index, element) => $(element).attr('href'))
|
||||||
.get()
|
.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(
|
const embedPages = await Promise.all(
|
||||||
embedRedirectURLs.map(
|
embedRedirectURLs.map(
|
||||||
@@ -32,7 +32,7 @@ export async function getEmbeds(ctx: ScrapeContext, id: string): Promise<EmbedsR
|
|||||||
.full(url, {
|
.full(url, {
|
||||||
headers: {
|
headers: {
|
||||||
cookie: `aGooz=${aGoozCookie}; ${RandomCookieName}=${RandomCookieValue};`,
|
cookie: `aGooz=${aGoozCookie}; ${RandomCookieName}=${RandomCookieValue};`,
|
||||||
Referer: 'https://ww1.goojara.to/eJwD5z',
|
Referer: baseUrl2,
|
||||||
},
|
},
|
||||||
method: 'GET',
|
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 type EmbedsResult = { embedId: string; url: string }[];
|
||||||
|
|
||||||
export interface Result {
|
export interface Result {
|
||||||
|
@@ -7,7 +7,7 @@ import { ScrapeContext } from '@/utils/context';
|
|||||||
import { NotFoundError } from '@/utils/errors';
|
import { NotFoundError } from '@/utils/errors';
|
||||||
|
|
||||||
import { getEmbeds } from './getEmbeds';
|
import { getEmbeds } from './getEmbeds';
|
||||||
import { EmbedsResult, Result } from './type';
|
import { EmbedsResult, Result, baseUrl } from './type';
|
||||||
|
|
||||||
let data;
|
let data;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ export async function searchAndFindMedia(
|
|||||||
media: MovieMedia | ShowMedia,
|
media: MovieMedia | ShowMedia,
|
||||||
): Promise<Result | undefined> {
|
): Promise<Result | undefined> {
|
||||||
data = await ctx.fetcher<string>(`/xhrr.php`, {
|
data = await ctx.fetcher<string>(`/xhrr.php`, {
|
||||||
baseUrl: 'https://www.goojara.to',
|
baseUrl,
|
||||||
headers: headersData,
|
headers: headersData,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: new URLSearchParams({ q: media.title }),
|
body: new URLSearchParams({ q: media.title }),
|
||||||
@@ -66,7 +66,7 @@ export async function scrapeIds(
|
|||||||
id = result.slug;
|
id = result.slug;
|
||||||
} else if (media.type === 'show') {
|
} else if (media.type === 'show') {
|
||||||
data = await ctx.fetcher<string>(`/${result.slug}`, {
|
data = await ctx.fetcher<string>(`/${result.slug}`, {
|
||||||
baseUrl: 'https://www.goojara.to',
|
baseUrl,
|
||||||
headers: headersData,
|
headers: headersData,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
@@ -78,7 +78,7 @@ export async function scrapeIds(
|
|||||||
if (!dataId) throw NotFoundError;
|
if (!dataId) throw NotFoundError;
|
||||||
|
|
||||||
data = await ctx.fetcher<string>(`/xhrc.php`, {
|
data = await ctx.fetcher<string>(`/xhrc.php`, {
|
||||||
baseUrl: 'https://ww1.goojara.to',
|
baseUrl,
|
||||||
headers: headersData,
|
headers: headersData,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: new URLSearchParams({ s: media.season.number.toString(), t: dataId }),
|
body: new URLSearchParams({ s: media.season.number.toString(), t: dataId }),
|
||||||
|
Reference in New Issue
Block a user