fix(extractor): do not mutate URLs to avoid cache misses

This commit is contained in:
WebStreamr 2025-06-04 13:23:54 +00:00
parent fef59dd03b
commit 1b8f75f00e
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View file

@ -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();

View file

@ -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[];