Update FileMoon.ts

To fix /d/ type of links which at the moment it failed to do so
This commit is contained in:
GSTAR 2025-12-17 16:51:19 +01:00 committed by GitHub
parent 10081a2276
commit 959bf0175d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -42,9 +42,13 @@ export class FileMoon extends Extractor {
}
public override normalize(url: URL): URL {
return new URL(url.href.replace('/e/', '/d/'));
if (url.pathname.startsWith('/d/')) {
return new URL(url.href.replace('/d/', '/e/'));
}
return url;
}
protected async extractInternal(ctx: Context, url: URL, meta: Meta, originalUrl?: URL): Promise<UrlResult[]> {
const headers = { Referer: meta.referer ?? url.href };