perf(extractor): do not guess size from mp4 for Uqload
This commit is contained in:
parent
e11cf8986e
commit
5e1c3eea24
5 changed files with 3 additions and 17 deletions
|
|
@ -1,8 +1,7 @@
|
|||
import * as cheerio from 'cheerio';
|
||||
import { NotFoundError } from '../error';
|
||||
import { Context, Format, Meta, UrlResult } from '../types';
|
||||
import { buildMediaFlowProxyExtractorRedirectUrl, MEDIAFLOW_DEFAULT_INIT, supportsMediaFlowProxy } from '../utils';
|
||||
import { guessSizeFromMp4 } from '../utils/size';
|
||||
import { buildMediaFlowProxyExtractorRedirectUrl, supportsMediaFlowProxy } from '../utils';
|
||||
import { Extractor } from './Extractor';
|
||||
|
||||
export class Uqload extends Extractor {
|
||||
|
|
@ -32,11 +31,9 @@ export class Uqload extends Extractor {
|
|||
const $ = cheerio.load(html);
|
||||
const title = $('h1').text().trim();
|
||||
|
||||
const mp4Url = buildMediaFlowProxyExtractorRedirectUrl(ctx, 'Uqload', url);
|
||||
|
||||
return [
|
||||
{
|
||||
url: mp4Url,
|
||||
url: buildMediaFlowProxyExtractorRedirectUrl(ctx, 'Uqload', url),
|
||||
format: Format.mp4,
|
||||
label: this.label,
|
||||
sourceId: `${this.id}_${meta.countryCodes?.join('_')}`,
|
||||
|
|
@ -44,7 +41,6 @@ export class Uqload extends Extractor {
|
|||
meta: {
|
||||
...meta,
|
||||
title,
|
||||
bytes: await guessSizeFromMp4(ctx, this.fetcher, mp4Url, { ...MEDIAFLOW_DEFAULT_INIT, headers: { Referer: url.href } }),
|
||||
...(heightMatch && {
|
||||
height: parseInt(heightMatch[1] as string),
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
{"connection":"close","content-length":"431690639","content-range":"bytes 0-431690638/431690639","content-type":"video/mp4","date":"Thu, 28 Aug 2025 19:12:32 GMT","etag":"\"680029e2-19bb138f\"","last-modified":"Wed, 16 Apr 2025 22:06:26 GMT","server":"nginx/1.24.0 (Ubuntu)"}
|
||||
|
|
@ -8,7 +8,6 @@ exports[`Uqload uqload.net /embed- 1`] = `
|
|||
"format": "mp4",
|
||||
"label": "Uqload (via MediaFlow Proxy)",
|
||||
"meta": {
|
||||
"bytes": 431690639,
|
||||
"countryCodes": [],
|
||||
"height": 360,
|
||||
"title": "Black Mirror S07E06 MULTI VFF 1080p WEBrip EAC3 5 1 x265-TyHD",
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ interface ExtractResult {
|
|||
query_params: Record<string, string>;
|
||||
}
|
||||
|
||||
export const MEDIAFLOW_DEFAULT_INIT: CustomRequestInit = {
|
||||
const MEDIAFLOW_DEFAULT_INIT: CustomRequestInit = {
|
||||
queueLimit: 4,
|
||||
queueTimeout: 10000,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
import { Context } from '../types';
|
||||
import { CustomRequestInit, Fetcher } from './Fetcher';
|
||||
|
||||
export const guessSizeFromMp4 = async (ctx: Context, fetcher: Fetcher, url: URL, init?: CustomRequestInit): Promise<number> => {
|
||||
const mp4Head = await fetcher.head(ctx, url, init);
|
||||
|
||||
return parseInt(mp4Head['content-length'] as string);
|
||||
};
|
||||
Loading…
Reference in a new issue