From 25d32117eda3857b3a6f4de2b9fe3a4444f6e111 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Mon, 14 Jul 2025 15:06:51 +0000 Subject: [PATCH] fix(extractor): support DoodStream via cloudflarestorage --- src/extractor/DoodStream.test.ts | 4 ++++ src/extractor/DoodStream.ts | 16 ++++++++++---- .../DoodStream/http:dood.toewfpwtsgyr1xi | 1 + ...d62f297b2b1efe192aig5l9qo88wwzt14z4izyrrn2 | 1 + .../__snapshots__/DoodStream.test.ts.snap | 22 +++++++++++++++++++ 5 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 src/extractor/__fixtures__/DoodStream/http:dood.toewfpwtsgyr1xi create mode 100644 src/extractor/__fixtures__/DoodStream/http:dood.topass_md5163663266-254-70-1752507840-ff2f201ab91945d62f297b2b1efe192aig5l9qo88wwzt14z4izyrrn2 diff --git a/src/extractor/DoodStream.test.ts b/src/extractor/DoodStream.test.ts index 105f868..4dfa3d1 100644 --- a/src/extractor/DoodStream.test.ts +++ b/src/extractor/DoodStream.test.ts @@ -26,4 +26,8 @@ describe('DoodStream', () => { test('can guess height from title', async () => { expect(await extractorRegistry.handle(ctx, new URL('https://do7go.com/e/dfx8me4un4ul'), CountryCode.fr)).toMatchSnapshot(); }); + + test('cloudflare storage', async () => { + expect(await extractorRegistry.handle(ctx, new URL('https://doodstream.com/e/wfpwtsgyr1xi'), CountryCode.mx)).toMatchSnapshot(); + }); }); diff --git a/src/extractor/DoodStream.ts b/src/extractor/DoodStream.ts index 26ebcdd..cc03a15 100644 --- a/src/extractor/DoodStream.ts +++ b/src/extractor/DoodStream.ts @@ -44,9 +44,17 @@ export class DoodStream extends Extractor { const $ = cheerio.load(html); const title = $('title').text().trim().replace(/ - DoodStream$/, '').trim(); - const mp4Url = new URL(`${baseUrl}${randomstring.generate(10)}?token=${token}&expiry=${Date.now()}`); - - const mp4Head = await this.fetcher.head(ctx, mp4Url, { headers: { Referer: url.origin } }); + let mp4Url: URL; + let bytes: number | undefined; + if (baseUrl.includes('cloudflarestorage')) { + mp4Url = new URL(baseUrl); + } else { + mp4Url = new URL(`${baseUrl}${randomstring.generate(10)}?token=${token}&expiry=${Date.now()}`); + const mp4Head = await this.fetcher.head(ctx, mp4Url, { headers: { Referer: url.origin } }); + if (mp4Head['content-length']) { + bytes = parseInt(mp4Head['content-length'] as string); + } + } return [ { @@ -58,7 +66,7 @@ export class DoodStream extends Extractor { meta: { countryCodes: [countryCode], title, - ...(mp4Head['content-length'] && { bytes: parseInt(mp4Head['content-length'] as string) }), + ...(bytes && { bytes }), }, requestHeaders: { Referer: url.origin, diff --git a/src/extractor/__fixtures__/DoodStream/http:dood.toewfpwtsgyr1xi b/src/extractor/__fixtures__/DoodStream/http:dood.toewfpwtsgyr1xi new file mode 100644 index 0000000..31085c8 --- /dev/null +++ b/src/extractor/__fixtures__/DoodStream/http:dood.toewfpwtsgyr1xi @@ -0,0 +1 @@ +
video you are looking for is not found.