From 1b8f75f00ef195649fa9ffa360b42bb1794f03c8 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Wed, 4 Jun 2025 13:23:54 +0000 Subject: [PATCH] fix(extractor): do not mutate URLs to avoid cache misses --- src/extractor/Dropload.ts | 4 ++-- src/extractor/SuperVideo.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/extractor/Dropload.ts b/src/extractor/Dropload.ts index 2ebff31..03c5403 100644 --- a/src/extractor/Dropload.ts +++ b/src/extractor/Dropload.ts @@ -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(); diff --git a/src/extractor/SuperVideo.ts b/src/extractor/SuperVideo.ts index a672f0d..593986f 100644 --- a/src/extractor/SuperVideo.ts +++ b/src/extractor/SuperVideo.ts @@ -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[];