Skip to content

Commit

Permalink
fix gdflix
Browse files Browse the repository at this point in the history
  • Loading branch information
mnsrulz committed Mar 10, 2024
1 parent 8a11d67 commit 9f05ed2
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/allResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
46 changes: 46 additions & 0 deletions src/libs/gdflixV2.ts
Original file line number Diff line number Diff line change
@@ -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<ResolvedMediaItem[]> {
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;
}
}
5 changes: 5 additions & 0 deletions src/libs/workers.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ export class WorkersDevResolver extends BaseUrlResolver {
} as ResolvedMediaItem;
return [result];
}

async canResolve(urlToResolve: string): Promise<boolean> {
const u = new URL(urlToResolve);
return u.hostname.endsWith('workers.dev');
}
}

0 comments on commit 9f05ed2

Please sign in to comment.