-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add allLinksHub and appDrive resolver
- Loading branch information
Showing
10 changed files
with
807 additions
and
46 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { BaseUrlResolver, ResolvedMediaItem } from "../BaseResolver.js"; | ||
|
||
|
||
|
||
export class AllLinksHubResolver extends BaseUrlResolver { | ||
constructor() { | ||
super({ | ||
domains: [/https?:\/\/link\.allinkshub/], | ||
useCookies: true | ||
}); | ||
} | ||
async resolveInner(_urlToResolve: string): Promise<ResolvedMediaItem | ResolvedMediaItem[]> { | ||
const responsev1 = await this.gotInstance(_urlToResolve); | ||
const al = this.parseAllLinks(responsev1.body, '.entry-content'); | ||
return al.map(m => { | ||
const link = this.nodeatob(new URL(m.link).searchParams.get('id') || ''); | ||
const title = m.title; | ||
return { link, title, parent: _urlToResolve } as ResolvedMediaItem; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { BaseUrlResolver, ResolvedMediaItem } from "../BaseResolver.js"; | ||
|
||
export class AppDriveResolver extends BaseUrlResolver { | ||
constructor() { | ||
super({ | ||
domains: [/https?:\/\/appdrive/], | ||
useCookies: true | ||
}); | ||
} | ||
async resolveInner(_urlToResolve: string): Promise<ResolvedMediaItem | ResolvedMediaItem[]> { | ||
const initialResponse = await this.gotInstance(_urlToResolve); | ||
const canonicalUrl = initialResponse.url; | ||
const keyRegex = /"key", "([^"]*)"/; | ||
const rxvalue = keyRegex.exec(initialResponse.body); | ||
const key = rxvalue?.[1]; | ||
|
||
const resp2 = await this.gotInstance.post(canonicalUrl, { | ||
form: { | ||
action: 'direct', | ||
key: key, | ||
action_token: '' | ||
}, | ||
headers: { | ||
'x-token': new URL(canonicalUrl).hostname, | ||
'Referer': canonicalUrl | ||
} | ||
}).json<{ url: string; }>(); | ||
|
||
const resp3 = await this.gotInstance(resp2.url); | ||
const gdlink = this.scrapeLinkHref(resp3.body, '#gdlink'); | ||
const urlRegex = /worker_url\s*=\s*'(https:\/\/[^']+)'/; | ||
const rx3respo = urlRegex.exec(resp3.body); | ||
const workersDev = rx3respo?.[1]; | ||
const linksToReturn = []; | ||
if (gdlink) { | ||
linksToReturn.push({ link: gdlink, title: 'workers', parent: _urlToResolve } as ResolvedMediaItem); | ||
} | ||
if (workersDev) { | ||
linksToReturn.push({ link: workersDev, title: 'drive', parent: _urlToResolve } as ResolvedMediaItem); | ||
} | ||
return linksToReturn; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters