From d44e0a2588fddc332d5bc833936e42fcd5ca2667 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:26:43 +0000 Subject: [PATCH] fix(extractor): handle FileMoon with missing height info in packed --- src/extractor/FileMoon.test.ts | 4 + src/extractor/FileMoon.ts | 4 +- .../FileMoon/https:filemoon.todugj7f1kq94p1 | 227 ++++++++++++++++++ .../FileMoon/https:ico3c.combkgugj7f1kq94p1 | 76 ++++++ ...ico3c.compercent2Fbkgpercent2Fugj7f1kq94p1 | 1 + .../__snapshots__/FileMoon.test.ts.snap | 16 ++ 6 files changed, 326 insertions(+), 2 deletions(-) create mode 100644 src/extractor/__fixtures__/FileMoon/https:filemoon.todugj7f1kq94p1 create mode 100644 src/extractor/__fixtures__/FileMoon/https:ico3c.combkgugj7f1kq94p1 create mode 100644 src/extractor/__fixtures__/FileMoon/https:mediaflow.test.orgextractorvideohostFileMoonandapi_passwordtestanddhttpspercent3Apercent2Fpercent2Ffilemoon.topercent2Fdpercent2Fugj7f1kq94p1andh_refererhttpspercent3Apercent2Fpercent2Fico3c.compercent2Fbkgpercent2Fugj7f1kq94p1 diff --git a/src/extractor/FileMoon.test.ts b/src/extractor/FileMoon.test.ts index c348db6..fbace69 100644 --- a/src/extractor/FileMoon.test.ts +++ b/src/extractor/FileMoon.test.ts @@ -17,4 +17,8 @@ describe('FileMoon', () => { test('page not found', async () => { expect(await extractorRegistry.handle(ctx, new URL('https://filemoon.sx/e/n7i8zodwjqr9'))).toMatchSnapshot(); }); + + test('missing height', async () => { + expect(await extractorRegistry.handle(ctx, new URL('https://filemoon.to/d/ugj7f1kq94p1'))).toMatchSnapshot(); + }); }); diff --git a/src/extractor/FileMoon.ts b/src/extractor/FileMoon.ts index ce9aa7d..afc686f 100644 --- a/src/extractor/FileMoon.ts +++ b/src/extractor/FileMoon.ts @@ -65,7 +65,7 @@ export class FileMoon extends Extractor { const playlistUrl = await buildMediaFlowProxyExtractorStreamUrl(ctx, this.fetcher, 'FileMoon', originalUrl as URL, headers); const unpacked = unpackEval(html); - const heightMatch = unpacked.match(/(\d{3,})p/) as string[]; + const heightMatch = unpacked.match(/(\d{3,})p/); return [ { @@ -75,7 +75,7 @@ export class FileMoon extends Extractor { ttl: this.ttl, meta: { ...meta, - height: parseInt(heightMatch[1] as string), + ...(heightMatch && { height: parseInt(heightMatch[1] as string) }), }, }, ]; diff --git a/src/extractor/__fixtures__/FileMoon/https:filemoon.todugj7f1kq94p1 b/src/extractor/__fixtures__/FileMoon/https:filemoon.todugj7f1kq94p1 new file mode 100644 index 0000000..60ccd4a --- /dev/null +++ b/src/extractor/__fixtures__/FileMoon/https:filemoon.todugj7f1kq94p1 @@ -0,0 +1,227 @@ + + + + + + + Watch tt0307453 + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+
+ +
+
+ +
+
+
+ + Log In + Sign Up + +
+
+ +
+
+
+
+
+ + + + + + + +
+
+
+
+
+

tt0307453

+
+
Uploaded: 2025-08-24 00:12:36 +
+
+
+
+ +
+
+ + + +
+
+ + + +
+
+ +
+ + + +
+ +
+
+ + + +
+
+ + + +
+
+ +
+
+ + +
+ Download +
+ + +
+
+
+ + + + + +
+ +
+ +
+
+
+ + Sign in + Sign up + +
+ + + + + + + diff --git a/src/extractor/__fixtures__/FileMoon/https:ico3c.combkgugj7f1kq94p1 b/src/extractor/__fixtures__/FileMoon/https:ico3c.combkgugj7f1kq94p1 new file mode 100644 index 0000000..9cf867f --- /dev/null +++ b/src/extractor/__fixtures__/FileMoon/https:ico3c.combkgugj7f1kq94p1 @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + +
+ + + + + + diff --git a/src/extractor/__fixtures__/FileMoon/https:mediaflow.test.orgextractorvideohostFileMoonandapi_passwordtestanddhttpspercent3Apercent2Fpercent2Ffilemoon.topercent2Fdpercent2Fugj7f1kq94p1andh_refererhttpspercent3Apercent2Fpercent2Fico3c.compercent2Fbkgpercent2Fugj7f1kq94p1 b/src/extractor/__fixtures__/FileMoon/https:mediaflow.test.orgextractorvideohostFileMoonandapi_passwordtestanddhttpspercent3Apercent2Fpercent2Ffilemoon.topercent2Fdpercent2Fugj7f1kq94p1andh_refererhttpspercent3Apercent2Fpercent2Fico3c.compercent2Fbkgpercent2Fugj7f1kq94p1 new file mode 100644 index 0000000..36882d3 --- /dev/null +++ b/src/extractor/__fixtures__/FileMoon/https:mediaflow.test.orgextractorvideohostFileMoonandapi_passwordtestanddhttpspercent3Apercent2Fpercent2Ffilemoon.topercent2Fdpercent2Fugj7f1kq94p1andh_refererhttpspercent3Apercent2Fpercent2Fico3c.compercent2Fbkgpercent2Fugj7f1kq94p1 @@ -0,0 +1 @@ +{"destination_url":"https://be7713.rcr82.waw05.i8yz83pn.com/hls2/05/09711/aeuhexjcoysl_x/master.m3u8?t=fiqqJThcgnrc77etu-nLPLodbF1UeqY5Cou0vvnLIB0&s=1765556185&e=10800&f=48721931&srv=1050&asn=13335&sp=5500&p=","request_headers":{"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36","referer":"https://ico3c.com/bkg/ugj7f1kq94p1"},"mediaflow_proxy_url":"https://mediaflow.test.org/proxy/hls/manifest.m3u8","query_params":{"api_password":"test"}} diff --git a/src/extractor/__snapshots__/FileMoon.test.ts.snap b/src/extractor/__snapshots__/FileMoon.test.ts.snap index 56c2fc3..838c3fa 100644 --- a/src/extractor/__snapshots__/FileMoon.test.ts.snap +++ b/src/extractor/__snapshots__/FileMoon.test.ts.snap @@ -1,5 +1,21 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +exports[`FileMoon missing height 1`] = ` +[ + { + "format": "hls", + "label": "FileMoon (MFP)", + "meta": { + "countryCodes": [], + "extractorId": "filemoon", + "title": "tt0307453", + }, + "ttl": 900000, + "url": "https://mediaflow.test.org/proxy/hls/manifest.m3u8?api_password=test&h_user-agent=Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F136.0.0.0+Safari%2F537.36&h_referer=https%3A%2F%2Fico3c.com%2Fbkg%2Fugj7f1kq94p1&d=https%3A%2F%2Fbe7713.rcr82.waw05.i8yz83pn.com%2Fhls2%2F05%2F09711%2Faeuhexjcoysl_x%2Fmaster.m3u8%3Ft%3DfiqqJThcgnrc77etu-nLPLodbF1UeqY5Cou0vvnLIB0%26s%3D1765556185%26e%3D10800%26f%3D48721931%26srv%3D1050%26asn%3D13335%26sp%3D5500%26p%3D", + }, +] +`; + exports[`FileMoon page not found 1`] = `[]`; exports[`FileMoon z1ekv717 d 1`] = `