diff --git a/src/allResolvers.ts b/src/allResolvers.ts index 603e5b3..231ffae 100644 --- a/src/allResolvers.ts +++ b/src/allResolvers.ts @@ -50,6 +50,7 @@ export * from "./libs/uptomegaResolver.js"; export * from "./libs/uploadFlix.js"; export * from "./libs/filePost.js"; export * from "./libs/gdflix.js"; +export * from "./libs/gdflixV2.js"; export * from "./libs/ahvsh.js"; export * from "./libs/addison.js"; export * from "./libs/mixdropResolver.js"; diff --git a/src/libs/gdflixV2.ts b/src/libs/gdflixV2.ts new file mode 100644 index 0000000..3be80c7 --- /dev/null +++ b/src/libs/gdflixV2.ts @@ -0,0 +1,46 @@ +import { BaseUrlResolver, ResolvedMediaItem } from "../BaseResolver.js"; + +export class gdflixV2Resolver extends BaseUrlResolver { + constructor() { + super({ + domains: [/https?:\/\/new\.gdflix/], + speedRank: 95, + useCookies: true + }); + } + + async resolveInner(_urlToResolve: string): Promise { + const response = await this.gotInstance(_urlToResolve); + const allLinks = this.scrapeAllLinks(response.body, 'body .text-center'); + const validLinks= allLinks.filter(v => !v.link.startsWith('https://new.gdflix') && !v.link.startsWith('https://t.me')); + try { + const rx = /formData\.append\("key", "([^"]*)"/; + const key = rx.exec(response.body)?.[1]; + const response2 = await this.gotInstance.post(_urlToResolve, { + form: { + action: "direct", + key: key, + action_token: "" + }, + headers: { + "x-token": "new.gdflix.cfd", + Referer: _urlToResolve + }, + followRedirect: false + }).json<{url:string}>(); + + const response3 = await this.gotInstance(response2.url); + const rx1 = /worker_url = '([^']*)'/ + const workerUrl = rx1.exec(response3.body)?.[1]; + if(workerUrl){ + validLinks.push({ + link: workerUrl, + title: 'cfworkers' + } as ResolvedMediaItem) + } + } catch (error) { + + } + return validLinks; + } +} diff --git a/src/libs/workers.dev.ts b/src/libs/workers.dev.ts index 255f6ee..7a9206b 100644 --- a/src/libs/workers.dev.ts +++ b/src/libs/workers.dev.ts @@ -17,4 +17,9 @@ export class WorkersDevResolver extends BaseUrlResolver { } as ResolvedMediaItem; return [result]; } + + async canResolve(urlToResolve: string): Promise { + const u = new URL(urlToResolve); + return u.hostname.endsWith('workers.dev'); + } } \ No newline at end of file