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 @@ +
Video is not ready.