chore(extractor): return only best Fsst result

it's too flaky to deal with all
This commit is contained in:
WebStreamr 2026-01-11 19:10:23 +00:00
parent 77cf6767b1
commit f49769f3c4
No known key found for this signature in database
3 changed files with 15 additions and 42 deletions

View file

@ -16,6 +16,7 @@ export class ExtractorRegistry {
this.extractors = extractors;
this.urlResultCache = new Cacheable({
nonBlocking: true,
primary: new Keyv({ store: new CacheableMemory({ lruSize: 1024 }) }),
secondary: new Keyv(new KeyvSqlite(`sqlite://${getCacheDir()}/webstreamr-extractor-cache.sqlite`)),
stats: true,

View file

@ -21,23 +21,20 @@ export class Fsst extends Extractor {
const filesMatch = html.match(/file:"(.*)"/) as string[];
return Promise.all(
(filesMatch[1] as string).split(',').map(async (fileString) => {
const heightAndUrlMatch = fileString.match(/\[?([\d]*)p?]?(.*)/) as string[];
const fileHref = heightAndUrlMatch[2] as string;
const lastFile = (filesMatch[1] as string).split(',').pop() as string;
return {
url: await this.fetcher.getFinalRedirectUrl(ctx, new URL(fileHref), { headers, noProxyHeaders: true }, 1),
format: Format.mp4,
label: this.label,
sourceId: `${this.id}_${meta.countryCodes?.join('_')}`,
meta: {
...meta,
height: parseInt(heightAndUrlMatch[1] as string),
title,
},
};
}),
);
const heightAndUrlMatch = lastFile.match(/\[?([\d]*)p?]?(.*)/) as string[];
const fileHref = heightAndUrlMatch[2] as string;
return [{
url: await this.fetcher.getFinalRedirectUrl(ctx, new URL(fileHref), { headers, noProxyHeaders: true }, 1),
format: Format.mp4,
label: this.label,
meta: {
...meta,
height: parseInt(heightAndUrlMatch[1] as string),
title,
},
}];
};
}

View file

@ -2,30 +2,6 @@
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",
"label": "Fsst",
@ -35,7 +11,6 @@ exports[`Fsst Wake up Dead Man 1`] = `
"height": 1080,
"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",
},
]