From b725354c1d16269eb363e4479674a3dc69d95efa Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Thu, 18 Dec 2025 15:01:07 +0000 Subject: [PATCH] Keep using /d/ URL but get last iframe url match --- src/extractor/FileMoon.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/extractor/FileMoon.ts b/src/extractor/FileMoon.ts index 8bdd746..d8bc8b4 100644 --- a/src/extractor/FileMoon.ts +++ b/src/extractor/FileMoon.ts @@ -42,10 +42,7 @@ export class FileMoon extends Extractor { } public override normalize(url: URL): URL { - if (url.pathname.startsWith('/d/')) { - return new URL(url.href.replace('/d/', '/e/')); - } - return url; + return new URL(url.href.replace('/e/', '/d/')); } protected async extractInternal(ctx: Context, url: URL, meta: Meta, originalUrl?: URL): Promise { @@ -60,9 +57,10 @@ export class FileMoon extends Extractor { const $ = cheerio.load(html); const title = $('h3').text().trim(); - const iframeUrlMatch = html.match(/iframe.*?src=["'](.*?)["']/); - if (iframeUrlMatch && iframeUrlMatch[1]) { - return await this.extractInternal(ctx, new URL(iframeUrlMatch[1]), { title, ...meta }, url); + const iframeUrlMatches = Array.from(html.matchAll(/iframe.*?src=["'](.*?)["']/g)); + if (iframeUrlMatches.length) { + // Use last match because there can be fake adblock catcher urls before + return await this.extractInternal(ctx, new URL((iframeUrlMatches[iframeUrlMatches.length - 1] as RegExpExecArray)[1] as string), { title, ...meta }, url); } const playlistUrl = await buildMediaFlowProxyExtractorStreamUrl(ctx, this.fetcher, 'FileMoon', originalUrl as URL, headers);