From b5c45d806e13639a986e152adc00002968d54e43 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Sun, 18 May 2025 21:48:17 +0200 Subject: [PATCH] refactor(extractor): manipulate URL instead of creating new one --- 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 919e89f..a98a71a 100644 --- a/src/extractor/Dropload.ts +++ b/src/extractor/Dropload.ts @@ -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[]; diff --git a/src/extractor/SuperVideo.ts b/src/extractor/SuperVideo.ts index 6565f31..baaec3d 100644 --- a/src/extractor/SuperVideo.ts +++ b/src/extractor/SuperVideo.ts @@ -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[];