chore(extractor): return only best Fsst result
it's too flaky to deal with all
This commit is contained in:
parent
77cf6767b1
commit
f49769f3c4
3 changed files with 15 additions and 42 deletions
|
|
@ -16,6 +16,7 @@ export class ExtractorRegistry {
|
||||||
this.extractors = extractors;
|
this.extractors = extractors;
|
||||||
|
|
||||||
this.urlResultCache = new Cacheable({
|
this.urlResultCache = new Cacheable({
|
||||||
|
nonBlocking: true,
|
||||||
primary: new Keyv({ store: new CacheableMemory({ lruSize: 1024 }) }),
|
primary: new Keyv({ store: new CacheableMemory({ lruSize: 1024 }) }),
|
||||||
secondary: new Keyv(new KeyvSqlite(`sqlite://${getCacheDir()}/webstreamr-extractor-cache.sqlite`)),
|
secondary: new Keyv(new KeyvSqlite(`sqlite://${getCacheDir()}/webstreamr-extractor-cache.sqlite`)),
|
||||||
stats: true,
|
stats: true,
|
||||||
|
|
|
||||||
|
|
@ -21,23 +21,20 @@ export class Fsst extends Extractor {
|
||||||
|
|
||||||
const filesMatch = html.match(/file:"(.*)"/) as string[];
|
const filesMatch = html.match(/file:"(.*)"/) as string[];
|
||||||
|
|
||||||
return Promise.all(
|
const lastFile = (filesMatch[1] as string).split(',').pop() as string;
|
||||||
(filesMatch[1] as string).split(',').map(async (fileString) => {
|
|
||||||
const heightAndUrlMatch = fileString.match(/\[?([\d]*)p?]?(.*)/) as string[];
|
|
||||||
const fileHref = heightAndUrlMatch[2] as string;
|
|
||||||
|
|
||||||
return {
|
const heightAndUrlMatch = lastFile.match(/\[?([\d]*)p?]?(.*)/) as string[];
|
||||||
url: await this.fetcher.getFinalRedirectUrl(ctx, new URL(fileHref), { headers, noProxyHeaders: true }, 1),
|
const fileHref = heightAndUrlMatch[2] as string;
|
||||||
format: Format.mp4,
|
|
||||||
label: this.label,
|
return [{
|
||||||
sourceId: `${this.id}_${meta.countryCodes?.join('_')}`,
|
url: await this.fetcher.getFinalRedirectUrl(ctx, new URL(fileHref), { headers, noProxyHeaders: true }, 1),
|
||||||
meta: {
|
format: Format.mp4,
|
||||||
...meta,
|
label: this.label,
|
||||||
height: parseInt(heightAndUrlMatch[1] as string),
|
meta: {
|
||||||
title,
|
...meta,
|
||||||
},
|
height: parseInt(heightAndUrlMatch[1] as string),
|
||||||
};
|
title,
|
||||||
}),
|
},
|
||||||
);
|
}];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,30 +2,6 @@
|
||||||
|
|
||||||
exports[`Fsst Wake up Dead Man 1`] = `
|
exports[`Fsst Wake up Dead Man 1`] = `
|
||||||
[
|
[
|
||||||
{
|
|
||||||
"format": "mp4",
|
|
||||||
"label": "Fsst",
|
|
||||||
"meta": {
|
|
||||||
"countryCodes": [],
|
|
||||||
"extractorId": "fsst",
|
|
||||||
"height": 360,
|
|
||||||
"title": "Wake.Up.Dead.Man.A.Knives.Out.Mystery.2025.mkv",
|
|
||||||
},
|
|
||||||
"sourceId": "fsst_",
|
|
||||||
"url": "https://a41.filevideo1.com/remote_control.php?time=1767712695&cv=a5df8582e6558fcf6bc25d7f02e5e646&lr=0&cv2=81173262e5b3e34fa9ebf67326ca98a5&file=%2Fvideos%2F948000%2F948429%2F948429_360p.mp4&cv3=2d8ee1a66c0ca6ce75d84c67a50a70e9&cv4=3ea2409b52380eb78c22c143fa6e27db",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"format": "mp4",
|
|
||||||
"label": "Fsst",
|
|
||||||
"meta": {
|
|
||||||
"countryCodes": [],
|
|
||||||
"extractorId": "fsst",
|
|
||||||
"height": 720,
|
|
||||||
"title": "Wake.Up.Dead.Man.A.Knives.Out.Mystery.2025.mkv",
|
|
||||||
},
|
|
||||||
"sourceId": "fsst_",
|
|
||||||
"url": "https://a41.filevideo1.com/remote_control.php?time=1767712695&cv=a5df8582e6558fcf6bc25d7f02e5e646&lr=0&cv2=81173262e5b3e34fa9ebf67326ca98a5&file=%2Fvideos%2F948000%2F948429%2F948429_720p.mp4&cv3=2d8ee1a66c0ca6ce75d84c67a50a70e9&cv4=6974d60c75ea0485c4f2a71b164a21ce",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"format": "mp4",
|
"format": "mp4",
|
||||||
"label": "Fsst",
|
"label": "Fsst",
|
||||||
|
|
@ -35,7 +11,6 @@ exports[`Fsst Wake up Dead Man 1`] = `
|
||||||
"height": 1080,
|
"height": 1080,
|
||||||
"title": "Wake.Up.Dead.Man.A.Knives.Out.Mystery.2025.mkv",
|
"title": "Wake.Up.Dead.Man.A.Knives.Out.Mystery.2025.mkv",
|
||||||
},
|
},
|
||||||
"sourceId": "fsst_",
|
|
||||||
"url": "https://a41.filevideo1.com/remote_control.php?time=1767712695&cv=a5df8582e6558fcf6bc25d7f02e5e646&lr=0&cv2=81173262e5b3e34fa9ebf67326ca98a5&file=%2Fvideos%2F948000%2F948429%2F948429.mp4&cv3=2d8ee1a66c0ca6ce75d84c67a50a70e9&cv4=7cf7fccae0c48291e3452c8ca2277f70",
|
"url": "https://a41.filevideo1.com/remote_control.php?time=1767712695&cv=a5df8582e6558fcf6bc25d7f02e5e646&lr=0&cv2=81173262e5b3e34fa9ebf67326ca98a5&file=%2Fvideos%2F948000%2F948429%2F948429.mp4&cv3=2d8ee1a66c0ca6ce75d84c67a50a70e9&cv4=7cf7fccae0c48291e3452c8ca2277f70",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue