refactor(extractor): manipulate URL instead of creating new one
This commit is contained in:
parent
fb61d39225
commit
b5c45d806e
2 changed files with 4 additions and 4 deletions
|
|
@ -19,8 +19,8 @@ export class Dropload implements Extractor {
|
|||
readonly supports = (url: URL): boolean => null !== url.host.match(/dropload/);
|
||||
|
||||
readonly extract = async (ctx: Context, url: URL, countryCode: string) => {
|
||||
const normalizedUrl = url.href.replace('/e/', '').replace('/embed-', '/');
|
||||
const html = await this.fetcher.text(ctx, new URL(normalizedUrl));
|
||||
url.pathname = url.pathname.replace('/e/', '').replace('/embed-', '/');
|
||||
const html = await this.fetcher.text(ctx, url);
|
||||
|
||||
const heightMatch = html.match(/\d{3,}x(\d{3,}),/) as string[];
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ export class SuperVideo implements Extractor {
|
|||
readonly supports = (url: URL): boolean => null !== url.host.match(/supervideo/);
|
||||
|
||||
readonly extract = async (ctx: Context, url: URL, countryCode: string) => {
|
||||
const normalizedUrl = url.href.replace('/e/', '/').replace('/embed-', '/');
|
||||
const html = await this.fetcher.text(ctx, new URL(normalizedUrl));
|
||||
url.pathname = url.pathname.replace('/e/', '').replace('/embed-', '/');
|
||||
const html = await this.fetcher.text(ctx, url);
|
||||
|
||||
const heightAndSizeMatch = html.match(/\d{3,}x(\d{3,}), ([\d.]+ ?[GM]B)/) as string[];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue