From f49769f3c4c2ca9cfca006a45d8a59c7bc3b68e8 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Sun, 11 Jan 2026 19:10:23 +0000 Subject: [PATCH] chore(extractor): return only best Fsst result it's too flaky to deal with all --- src/extractor/ExtractorRegistry.ts | 1 + src/extractor/Fsst.ts | 31 +++++++++---------- src/extractor/__snapshots__/Fsst.test.ts.snap | 25 --------------- 3 files changed, 15 insertions(+), 42 deletions(-) diff --git a/src/extractor/ExtractorRegistry.ts b/src/extractor/ExtractorRegistry.ts index 7a5b58b..4a24b32 100644 --- a/src/extractor/ExtractorRegistry.ts +++ b/src/extractor/ExtractorRegistry.ts @@ -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, diff --git a/src/extractor/Fsst.ts b/src/extractor/Fsst.ts index 36bea44..3e6fcc9 100644 --- a/src/extractor/Fsst.ts +++ b/src/extractor/Fsst.ts @@ -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, + }, + }]; }; } diff --git a/src/extractor/__snapshots__/Fsst.test.ts.snap b/src/extractor/__snapshots__/Fsst.test.ts.snap index 0953e88..5b93cb9 100644 --- a/src/extractor/__snapshots__/Fsst.test.ts.snap +++ b/src/extractor/__snapshots__/Fsst.test.ts.snap @@ -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", }, ]