diff --git a/src/extractor/DoodStream.test.ts b/src/extractor/DoodStream.test.ts index d896635..92ac1fd 100644 --- a/src/extractor/DoodStream.test.ts +++ b/src/extractor/DoodStream.test.ts @@ -25,4 +25,8 @@ describe('DoodStream', () => { test('cloudflare storage', async () => { expect(await extractorRegistry.handle(ctx, new URL('https://doodstream.com/e/wfpwtsgyr1xi'))).toMatchSnapshot(); }); + + test('not found', async () => { + expect(await extractorRegistry.handle(ctx, new URL('https://myvidplay.com/e/cz7cus0bvlzr'))).toMatchSnapshot(); + }); }); diff --git a/src/extractor/DoodStream.ts b/src/extractor/DoodStream.ts index 42d4736..658a453 100644 --- a/src/extractor/DoodStream.ts +++ b/src/extractor/DoodStream.ts @@ -28,14 +28,14 @@ export class DoodStream extends Extractor { const html = await this.fetcher.text(ctx, url, { headers }); - const passMd5Match = html.match(/\/pass_md5\/[\w-]+\/([\w-]+)/); - if (!passMd5Match) { + if (/Video not found/.test(html)) { throw new NotFoundError(); } + const passMd5Match = html.match(/\/pass_md5\/[\w-]+\/([\w-]+)/) as string[]; const token = passMd5Match[1] as string; - const baseUrl = await this.fetcher.text(ctx, new URL(passMd5Match[0], url.origin), { headers: { Referer: url.href } }); + const baseUrl = await this.fetcher.text(ctx, new URL(passMd5Match[0] as string, url.origin), { headers: { Referer: url.href } }); const $ = cheerio.load(html); const title = $('title').text().trim().replace(/ - DoodStream$/, '').trim(); diff --git a/src/extractor/__fixtures__/DoodStream/http:dood.toecz7cus0bvlzr b/src/extractor/__fixtures__/DoodStream/http:dood.toecz7cus0bvlzr new file mode 100644 index 0000000..ba9ff3b --- /dev/null +++ b/src/extractor/__fixtures__/DoodStream/http:dood.toecz7cus0bvlzr @@ -0,0 +1 @@ +
video you are looking for is not found.