Keep using /d/ URL but get last iframe url match
This commit is contained in:
parent
90e0315f8a
commit
b725354c1d
1 changed files with 5 additions and 7 deletions
|
|
@ -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<UrlResult[]> {
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue