fix(extractor): remove referer header from Mixdrop

This commit is contained in:
WebStreamr 2025-10-06 07:48:35 +00:00
parent 5a4f28e50a
commit eea8cac018
No known key found for this signature in database
3 changed files with 4 additions and 6 deletions

View file

@ -19,10 +19,8 @@ export class Mixdrop extends Extractor {
public override readonly normalize = (url: URL): URL => new URL(url.href.replace('/f/', '/e/'));
protected async extractInternal(ctx: Context, url: URL, meta: Meta): Promise<UrlResult[]> {
const headers = { Referer: meta.referer ?? url.href };
const fileUrl = new URL(url.href.replace('/e/', '/f/'));
const html = await this.fetcher.text(ctx, fileUrl, { headers });
const html = await this.fetcher.text(ctx, fileUrl);
if (/can't find the (file|video)/.test(html)) {
throw new NotFoundError();
@ -35,7 +33,7 @@ export class Mixdrop extends Extractor {
return [
{
url: buildMediaFlowProxyExtractorRedirectUrl(ctx, 'Mixdrop', url, headers),
url: buildMediaFlowProxyExtractorRedirectUrl(ctx, 'Mixdrop', url),
format: Format.mp4,
label: this.label,
sourceId: `${this.id}_${meta.countryCodes?.join('_')}`,

View file

@ -14,7 +14,7 @@ exports[`Mixdrop mixdrop.my /e/ 1`] = `
},
"sourceId": "mixdrop_",
"ttl": 900000,
"url": "https://mediaflow-proxy.test/extractor/video?host=Mixdrop&api_password=asdfg&d=https%3A%2F%2Fmixdrop.my%2Fe%2Fknq0kj8waq44l8&h_referer=https%3A%2F%2Fmixdrop.my%2Fe%2Fknq0kj8waq44l8&redirect_stream=true",
"url": "https://mediaflow-proxy.test/extractor/video?host=Mixdrop&api_password=asdfg&d=https%3A%2F%2Fmixdrop.my%2Fe%2Fknq0kj8waq44l8&redirect_stream=true",
},
]
`;

View file

@ -24,7 +24,7 @@ const buildMediaFlowProxyExtractorUrl = (ctx: Context, host: string, url: URL, h
return mediaFlowProxyUrl;
};
export const buildMediaFlowProxyExtractorRedirectUrl = (ctx: Context, host: string, url: URL, headers: Record<string, string>): URL => {
export const buildMediaFlowProxyExtractorRedirectUrl = (ctx: Context, host: string, url: URL, headers: Record<string, string> = {}): URL => {
const mediaFlowProxyUrl = buildMediaFlowProxyExtractorUrl(ctx, host, url, headers);
mediaFlowProxyUrl.searchParams.append('redirect_stream', 'true');