diff --git a/src/extractor/FileLions.test.ts b/src/extractor/FileLions.test.ts index 824aef6..1cf4b3c 100644 --- a/src/extractor/FileLions.test.ts +++ b/src/extractor/FileLions.test.ts @@ -17,4 +17,8 @@ describe('FileLions', () => { test('mivalyo v referer lock', async () => { expect(await extractorRegistry.handle(ctx, new URL('https://mivalyo.com/v/tah5znapz3e5'), { referer: 'https://kinoger.com' })).toMatchSnapshot(); }); + + test('file not found', async () => { + expect(await extractorRegistry.handle(ctx, new URL('https://filelions.to/v/ylcp2cu5qanb'))).toMatchSnapshot(); + }); }); diff --git a/src/extractor/FileLions.ts b/src/extractor/FileLions.ts index ea5cf7c..43c8a6d 100644 --- a/src/extractor/FileLions.ts +++ b/src/extractor/FileLions.ts @@ -1,5 +1,6 @@ import bytes from 'bytes'; import * as cheerio from 'cheerio'; +import { NotFoundError } from '../error'; import { Context, Format, Meta, UrlResult } from '../types'; import { buildMediaFlowProxyExtractorStreamUrl, @@ -67,13 +68,17 @@ export class FileLions extends Extractor { protected async extractInternal(ctx: Context, url: URL, meta: Meta): Promise { const headers = { Referer: meta.referer ?? url.href }; - const playlistUrl = await buildMediaFlowProxyExtractorStreamUrl(ctx, this.fetcher, 'FileLions', url, headers); - const fileUrl = new URL(url.href.replace('/v/', '/f/')); const html = await this.fetcher.text(ctx, fileUrl, { headers }); + if (/File Not Found/.test(html)) { + throw new NotFoundError(); + } + const sizeMatch = html.match(/([\d.]+ ?[GM]B)/); + const playlistUrl = await buildMediaFlowProxyExtractorStreamUrl(ctx, this.fetcher, 'FileLions', url, headers); + const $ = cheerio.load(html); const title = $('title').text().trim().replace(/^Watch /, '').trim(); diff --git a/src/extractor/__fixtures__/FileLions/https:filelions.tofylcp2cu5qanb b/src/extractor/__fixtures__/FileLions/https:filelions.tofylcp2cu5qanb new file mode 100644 index 0000000..59d9e6a --- /dev/null +++ b/src/extractor/__fixtures__/FileLions/https:filelions.tofylcp2cu5qanb @@ -0,0 +1,161 @@ + + + + + + + + Watch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + +
+
+ + +
+
+
+ + +
+
+
+
+
+
+ +
+
+

+ File Not Found +

+
+

The file you were looking for could not be found, sorry for any inconvenience.

+
+
+ +
+

Possible causes of this error could be:

+
+
+
    +
  • + The file expired +
  • + The file was deleted by its owner +
  • + The file was deleted by administration because it didn't comply with our Terms of Use +
+
+
+
+
+
+
+ + + + + + diff --git a/src/extractor/__snapshots__/FileLions.test.ts.snap b/src/extractor/__snapshots__/FileLions.test.ts.snap index e13160e..45aa269 100644 --- a/src/extractor/__snapshots__/FileLions.test.ts.snap +++ b/src/extractor/__snapshots__/FileLions.test.ts.snap @@ -1,5 +1,7 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +exports[`FileLions file not found 1`] = `[]`; + exports[`FileLions filelions f 1`] = ` [ {