diff --git a/src/providers/sources/ee3/types.ts b/src/providers/sources/ee3/types.ts deleted file mode 100644 index 6728c9c..0000000 --- a/src/providers/sources/ee3/types.ts +++ /dev/null @@ -1,31 +0,0 @@ -export interface itemDetails { - status: number; - message: { - id: string; - imdbID: string; - title: string; - video: string; - server: string; - year: string; - image: string; - glow: string; - rating: string; - watch_count: string; - datetime?: string | null; - requested_by?: string | null; - subs?: string | null; - time?: string | null; - duration?: string | null; - }; -} - -export interface renewResponse { - k: string; - msg?: string | null; - status: number | string | null; -} - -export interface loginResponse { - status: number; - message: string; -} diff --git a/src/providers/sources/ee3/utils.ts b/src/providers/sources/ee3/utils.ts deleted file mode 100644 index a797977..0000000 --- a/src/providers/sources/ee3/utils.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { load } from 'cheerio'; - -import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context'; -import { parseSetCookie } from '@/utils/cookie'; - -import { baseUrl } from './common'; -import { loginResponse } from './types'; - -export async function login( - user: string, - pass: string, - ctx: ShowScrapeContext | MovieScrapeContext, -): Promise { - const req = await ctx.proxiedFetcher.full('/login', { - baseUrl, - method: 'POST', - body: new URLSearchParams({ user, pass, action: 'login' }), - readHeaders: ['Set-Cookie'], - }); - const res: loginResponse = JSON.parse(req.body); - - const cookie = parseSetCookie( - // It retruns a cookie even when the login failed - // I have the backup cookie here just in case - res.status === 1 ? (req.headers.get('Set-Cookie') ?? '') : 'PHPSESSID=mk2p73c77qc28o5i5120843ruu;', - ); - - return cookie.PHPSESSID.value; -} - -export function parseSearch(body: string): { title: string; year: number; id: string }[] { - const result: { title: string; year: number; id: string }[] = []; - - const $ = load(body); - $('div').each((_, element) => { - const title = $(element).find('.title').text().trim(); - const year = parseInt($(element).find('.details span').first().text().trim(), 10); - const id = $(element).find('.control-buttons').attr('data-id'); - - if (title && year && id) { - result.push({ title, year, id }); - } - }); - - return result; -}