fix(extractor): do not mutate URLs to avoid cache misses
This commit is contained in:
parent
fef59dd03b
commit
1b8f75f00e
2 changed files with 4 additions and 4 deletions
|
|
@ -21,8 +21,8 @@ export class Dropload implements Extractor {
|
|||
readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/dropload/);
|
||||
|
||||
readonly extract = async (ctx: Context, url: URL, meta: Meta) => {
|
||||
url.pathname = url.pathname.replace('/e/', '').replace('/embed-', '/');
|
||||
const html = await this.fetcher.text(ctx, url);
|
||||
const normalizedUrl = new URL(url.href.replace('/e/', '/').replace('/embed-', '/'));
|
||||
const html = await this.fetcher.text(ctx, normalizedUrl);
|
||||
|
||||
if (html.includes('File Not Found')) {
|
||||
throw new NotFoundError();
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ export class SuperVideo implements Extractor {
|
|||
readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/supervideo/);
|
||||
|
||||
readonly extract = async (ctx: Context, url: URL, meta: Meta) => {
|
||||
url.pathname = url.pathname.replace('/e/', '').replace('/embed-', '/');
|
||||
const html = await this.fetcher.text(ctx, url);
|
||||
const normalizedUrl = new URL(url.href.replace('/e/', '/').replace('/embed-', '/'));
|
||||
const html = await this.fetcher.text(ctx, normalizedUrl);
|
||||
|
||||
const heightAndSizeMatch = html.match(/\d{3,}x(\d{3,}), ([\d.]+ ?[GM]B)/) as string[];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue