diff --git a/src/extractor/VidSrc.test.ts b/src/extractor/VidSrc.test.ts index 5bc3bde..8cb3ff9 100644 --- a/src/extractor/VidSrc.test.ts +++ b/src/extractor/VidSrc.test.ts @@ -21,4 +21,8 @@ describe('VidSrc', () => { test('Black Mirror', async () => { expect(await extractorRegistry.handle(ctx, new URL('https://vidsrc.xyz/embed/tv/tt2085059/4/2'), CountryCode.en, 'Black Mirror 4x2')).toMatchSnapshot(); }); + + test('not found', async () => { + expect(await extractorRegistry.handle(ctx, new URL('https://vidsrc.xyz/embed/movie/tt35628853'), CountryCode.en, 'Black Mirror 4x2')).toMatchSnapshot(); + }); }); diff --git a/src/extractor/VidSrc.ts b/src/extractor/VidSrc.ts index ddb7cb6..b3842b4 100644 --- a/src/extractor/VidSrc.ts +++ b/src/extractor/VidSrc.ts @@ -3,6 +3,7 @@ import slugify from 'slugify'; import { Extractor } from './types'; import { Fetcher, guessFromPlaylist } from '../utils'; import { Context, CountryCode, UrlResult } from '../types'; +import { NotFoundError } from '../error'; export class VidSrc implements Extractor { readonly id = 'vidsrc'; @@ -39,7 +40,10 @@ export class VidSrc implements Extractor { const srcMatch = iframeHtml.match(`src:\\s?'(.*)'`) as string[]; const playerHtml = await this.fetcher.text(ctx, new URL(srcMatch[1] as string, iframeUrl.origin)); - const fileMatch = playerHtml.match(`file:\\s?'(.*)'`) as string[]; + const fileMatch = playerHtml.match(`file:\\s?'(.*)'`); + if (!fileMatch) { + throw new NotFoundError(); + } const m3u8Url = new URL(fileMatch[1] as string); const height = await guessFromPlaylist(ctx, this.fetcher, m3u8Url, { noReferer: true }); diff --git a/src/extractor/__snapshots__/VidSrc.test.ts.snap b/src/extractor/__snapshots__/VidSrc.test.ts.snap index 0974ac7..f278642 100644 --- a/src/extractor/__snapshots__/VidSrc.test.ts.snap +++ b/src/extractor/__snapshots__/VidSrc.test.ts.snap @@ -31,3 +31,5 @@ exports[`VidSrc Full Metal Jacket 1`] = ` }, ] `; + +exports[`VidSrc not found 1`] = `[]`; diff --git a/src/utils/__fixtures__/Fetcher/https:cloudnestra.com-5390c57601d41d8b477456604a1ad54f b/src/utils/__fixtures__/Fetcher/https:cloudnestra.com-5390c57601d41d8b477456604a1ad54f new file mode 100644 index 0000000..7a52780 --- /dev/null +++ b/src/utils/__fixtures__/Fetcher/https:cloudnestra.com-5390c57601d41d8b477456604a1ad54f @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + +
+
+
+ Titan: The OceanGate Disaster (2025)
+ +
+
+ +
+ + + + + + + + + + + + + + + + + diff --git a/src/utils/__fixtures__/Fetcher/https:cloudnestra.com-e5e131170ee0c45ac5e5829553d7e23e b/src/utils/__fixtures__/Fetcher/https:cloudnestra.com-e5e131170ee0c45ac5e5829553d7e23e new file mode 100644 index 0000000..6236659 --- /dev/null +++ b/src/utils/__fixtures__/Fetcher/https:cloudnestra.com-e5e131170ee0c45ac5e5829553d7e23e @@ -0,0 +1,803 @@ + + + +Titan: The OceanGate Disaster (2025) + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/utils/__fixtures__/Fetcher/https:vidsrc.xyzembedmoviett35628853 b/src/utils/__fixtures__/Fetcher/https:vidsrc.xyzembedmoviett35628853 new file mode 100644 index 0000000..2c827d2 --- /dev/null +++ b/src/utils/__fixtures__/Fetcher/https:vidsrc.xyzembedmoviett35628853 @@ -0,0 +1,268 @@ + + + +Titan: The OceanGate Disaster (2025) + + + + + + + + + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +