From d76eba6747970019efa292a2640bdb3ac1b8c88f Mon Sep 17 00:00:00 2001 From: mnsrulz Date: Sat, 31 Aug 2024 04:23:05 +0000 Subject: [PATCH] hubcloud resolver fix --- src/libs/hubCloudResolver-v2.ts | 2 +- src/libs/hubCloudResolver.ts | 11 ++++++++++- src/libs/workers.dev.ts | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/libs/hubCloudResolver-v2.ts b/src/libs/hubCloudResolver-v2.ts index 77a69b8..84bd4f5 100644 --- a/src/libs/hubCloudResolver-v2.ts +++ b/src/libs/hubCloudResolver-v2.ts @@ -5,7 +5,7 @@ export class HubCloudResolverV2 extends BaseUrlResolver { constructor() { super({ - domains: [/https?:\/\/(hubcloud.link)/], + domains: [/https?:\/\/(hubcloud)/], speedRank: 90, useCookies: true }); diff --git a/src/libs/hubCloudResolver.ts b/src/libs/hubCloudResolver.ts index e8a9e83..89ea04b 100644 --- a/src/libs/hubCloudResolver.ts +++ b/src/libs/hubCloudResolver.ts @@ -5,7 +5,7 @@ export class HubCloudResolver extends BaseUrlResolver { constructor() { super({ - domains: [/https?:\/\/(hubcloud.link)/], + domains: [/https?:\/\/(hubcloud)/], speedRank: 90 }); } @@ -18,7 +18,16 @@ export class HubCloudResolver extends BaseUrlResolver { const regex01Result = regex01.exec(response.body); link = regex01Result?.[1] || ''; } + const title = this.extractFileNameFromUrl(link); + + if (title.endsWith('.php')) { + //it's a redirect + const rsp2 = await this.gotInstance(link); + const result_01 = this.scrapeAllLinks(rsp2.body, '.card-body'); + return result_01; + } + const result = { link, title, diff --git a/src/libs/workers.dev.ts b/src/libs/workers.dev.ts index 7a9206b..55e54f5 100644 --- a/src/libs/workers.dev.ts +++ b/src/libs/workers.dev.ts @@ -20,6 +20,6 @@ export class WorkersDevResolver extends BaseUrlResolver { async canResolve(urlToResolve: string): Promise { const u = new URL(urlToResolve); - return u.hostname.endsWith('workers.dev'); + return u.hostname.endsWith('workers.dev') || u.hostname.endsWith('r2.dev'); } } \ No newline at end of file