mirror of
https://github.com/sussy-code/providers.git
synced 2026-03-11 17:55:37 +00:00
Update login
This commit is contained in:
parent
1bc744d48d
commit
34b2fb74ae
3 changed files with 20 additions and 15 deletions
|
|
@ -2,6 +2,6 @@ export const useAltEndpoint: boolean = false;
|
|||
|
||||
export const baseUrl = useAltEndpoint ? 'https://rips.cc' : 'https://ee3.me';
|
||||
|
||||
export const username = '';
|
||||
export const username = '_sf_';
|
||||
|
||||
export const password = '';
|
||||
export const password = 'defonotscraping';
|
||||
|
|
|
|||
|
|
@ -24,3 +24,8 @@ export interface renewResponse {
|
|||
msg?: string | null;
|
||||
status: number | string | null;
|
||||
}
|
||||
|
||||
export interface loginResponse {
|
||||
status: number;
|
||||
message: string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,28 +4,28 @@ 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<string | null> {
|
||||
let req;
|
||||
if (user && pass)
|
||||
req = await ctx.proxiedFetcher.full<string>('/login', {
|
||||
baseUrl,
|
||||
method: 'POST',
|
||||
body: new URLSearchParams({ user, pass, action: 'login' }),
|
||||
readHeaders: ['Set-Cookie'],
|
||||
});
|
||||
const req = await ctx.proxiedFetcher.full<string>('/login', {
|
||||
baseUrl,
|
||||
method: 'POST',
|
||||
body: new URLSearchParams({ user, pass, action: 'login' }),
|
||||
readHeaders: ['Set-Cookie'],
|
||||
});
|
||||
const res: loginResponse = JSON.parse(req.body);
|
||||
|
||||
const cookies = parseSetCookie(
|
||||
req?.headers.get('Set-Cookie') ||
|
||||
// we don't wan't our creds to be in the code
|
||||
'PHPSESSID=phmje3cqeft42rckf8mj7illhc;',
|
||||
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 cookies.PHPSESSID.value;
|
||||
return cookie.PHPSESSID.value;
|
||||
}
|
||||
|
||||
export function parseSearch(body: string): { title: string; year: number; id: string }[] {
|
||||
|
|
|
|||
Loading…
Reference in a new issue