diff --git a/src/extractor/StreamEmbed.test.ts b/src/extractor/StreamEmbed.test.ts index 9118815..9982968 100644 --- a/src/extractor/StreamEmbed.test.ts +++ b/src/extractor/StreamEmbed.test.ts @@ -13,4 +13,8 @@ describe('StreamEmbed', () => { test('watch.gxplayer.xyz', async () => { expect(await extractorRegistry.handle(ctx, new URL('https://watch.gxplayer.xyz/watch?v=MEKI92PU'))).toMatchSnapshot(); }); + + test('video is not ready', async () => { + expect(await extractorRegistry.handle(ctx, new URL('https://watch.gxplayer.xyz/watch?v=PBO90WAS'))).toMatchSnapshot(); + }); }); diff --git a/src/extractor/StreamEmbed.ts b/src/extractor/StreamEmbed.ts index 70883f8..0383df4 100644 --- a/src/extractor/StreamEmbed.ts +++ b/src/extractor/StreamEmbed.ts @@ -1,3 +1,4 @@ +import { NotFoundError } from '../error'; import { Context, Format, Meta, UrlResult } from '../types'; import { Extractor } from './Extractor'; @@ -15,6 +16,10 @@ export class StreamEmbed extends Extractor { const html = await this.fetcher.text(ctx, url, { headers }); + if (/Video is not ready/.test(html)) { + throw new NotFoundError(); + } + const video = JSON.parse((html.match(/video ?= ?(.*);/) as string[])[1] as string); return [ diff --git a/src/extractor/__fixtures__/StreamEmbed/https:watch.gxplayer.xyzwatchvPBO90WAS b/src/extractor/__fixtures__/StreamEmbed/https:watch.gxplayer.xyzwatchvPBO90WAS new file mode 100644 index 0000000..ef0900f --- /dev/null +++ b/src/extractor/__fixtures__/StreamEmbed/https:watch.gxplayer.xyzwatchvPBO90WAS @@ -0,0 +1 @@ +Warning

Warning

Video is not ready.

\ No newline at end of file diff --git a/src/extractor/__snapshots__/StreamEmbed.test.ts.snap b/src/extractor/__snapshots__/StreamEmbed.test.ts.snap index e2ab8a4..27d1711 100644 --- a/src/extractor/__snapshots__/StreamEmbed.test.ts.snap +++ b/src/extractor/__snapshots__/StreamEmbed.test.ts.snap @@ -1,5 +1,7 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +exports[`StreamEmbed video is not ready 1`] = `[]`; + exports[`StreamEmbed watch.gxplayer.xyz 1`] = ` [ {