From ccb029db1db2cf9ad5ce26f54c7469521bd0aa91 Mon Sep 17 00:00:00 2001 From: memecornucopia Date: Thu, 1 Feb 2024 12:19:28 -0500 Subject: [PATCH 1/3] Fix Goojara Scraping and Capitilization --- src/providers/sources/goojara/index.ts | 4 ++-- src/providers/sources/goojara/util.ts | 19 +++---------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/providers/sources/goojara/index.ts b/src/providers/sources/goojara/index.ts index ea85d3d..e0f1860 100644 --- a/src/providers/sources/goojara/index.ts +++ b/src/providers/sources/goojara/index.ts @@ -20,8 +20,8 @@ async function universalScraper(ctx: ShowScrapeContext | MovieScrapeContext): Pr } export const goojaraScraper = makeSourcerer({ - id: 'goojara', - name: 'goojara', + id: 'Goojara', + name: 'Goojara', rank: 225, flags: [], scrapeShow: universalScraper, diff --git a/src/providers/sources/goojara/util.ts b/src/providers/sources/goojara/util.ts index 30d63a9..857ec0b 100644 --- a/src/providers/sources/goojara/util.ts +++ b/src/providers/sources/goojara/util.ts @@ -49,7 +49,6 @@ export async function searchAndFindMedia( }); const result = results.find((res: Result) => compareMedia(media, res.title, Number(res.year))); - return result; } @@ -67,29 +66,17 @@ export async function scrapeIds( baseUrl, headers: headersData, method: 'GET', - }); - - const $1 = load(data); - - const dataId = $1('#seon').attr('data-id'); - - if (!dataId) throw new NotFoundError('Not found'); - - data = await ctx.fetcher(`/xhrc.php`, { - baseUrl, - headers: headersData, - method: 'POST', - body: new URLSearchParams({ s: media.season.number.toString(), t: dataId }), + query: { s: media.season.number.toString() }, }); let episodeId = ''; const $2 = load(data); - $2('.seho').each((index, element) => { + $2('.seho').each((_index: any, element: any) => { // Extracting the episode number as a string const episodeNumber = $2(element).find('.seep .sea').text().trim(); - + console.log(episodeNumber); // Comparing with the desired episode number as a string if (parseInt(episodeNumber, 10) === media.episode.number) { const href = $2(element).find('.snfo h1 a').attr('href'); From ac2261bbd11ee3ac92dbc25e852a3421d2434951 Mon Sep 17 00:00:00 2001 From: memecornucopia Date: Thu, 1 Feb 2024 14:34:11 -0500 Subject: [PATCH 2/3] Fix Wootly, Fix Goojara, Fix Id. --- src/providers/embeds/dood.ts | 3 +-- src/providers/embeds/wootly.ts | 27 ++++++++++++++++++---- src/providers/sources/goojara/getEmbeds.ts | 21 +++++++++++------ src/providers/sources/goojara/index.ts | 2 +- src/providers/sources/goojara/util.ts | 3 +-- 5 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/providers/embeds/dood.ts b/src/providers/embeds/dood.ts index faa79d8..7a5fba1 100644 --- a/src/providers/embeds/dood.ts +++ b/src/providers/embeds/dood.ts @@ -21,14 +21,13 @@ export const doodScraper = makeEmbed({ const dataForLater = doodData.match(/a\+"\?token=([^"]+)/)?.[1]; const path = doodData.match(/\$\.get\('\/pass_md5([^']+)/)?.[1]; - const doodPage = await ctx.proxiedFetcher(`/pass_md5/${path}`, { + const doodPage = await ctx.proxiedFetcher(`/pass_md5${path}`, { headers: { referer: `${baseUrl}/e/${id}`, }, method: 'GET', baseUrl, }); - const downloadURL = `${doodPage}${nanoid()}?token=${dataForLater}${Date.now()}`; return { diff --git a/src/providers/embeds/wootly.ts b/src/providers/embeds/wootly.ts index 0119926..3d75cbb 100644 --- a/src/providers/embeds/wootly.ts +++ b/src/providers/embeds/wootly.ts @@ -17,7 +17,13 @@ export const wootlyScraper = makeEmbed({ }); const cookies = parseSetCookie(wootlyData.headers.get('Set-Cookie') || ''); - const wootssesCookie = cookies.wootsses.value; + let wootssesCookie = ''; + let cookie = ''; + + if (cookies && cookies.wootsses) { + wootssesCookie = cookies.wootsses.value; + cookie = makeCookieHeader({ wootsses: wootssesCookie }); + } let $ = load(wootlyData.body); // load the html data const iframeSrc = $('iframe').attr('src') ?? ''; @@ -26,18 +32,24 @@ export const wootlyScraper = makeEmbed({ method: 'GET', readHeaders: ['Set-Cookie'], headers: { - cookie: makeCookieHeader({ wootsses: wootssesCookie }), + cookie, }, }); const woozCookies = parseSetCookie(woozCookieRequest.headers.get('Set-Cookie') || ''); - const woozCookie = woozCookies.wooz.value; + let woozCookie = ''; + cookie = ''; + + if (cookies && woozCookies.wooz) { + woozCookie = woozCookies.wooz.value; + cookie = makeCookieHeader({ wooz: woozCookie }); + } const iframeData = await ctx.proxiedFetcher(iframeSrc, { method: 'POST', body: new URLSearchParams({ qdf: '1' }), headers: { - cookie: makeCookieHeader({ wooz: woozCookie }), + cookie, Referer: iframeSrc, }, }); @@ -51,13 +63,18 @@ export const wootlyScraper = makeEmbed({ const vd = scriptText.match(/vd=([^,]+)/)?.[0].replace(/vd=|["\s]/g, ''); if (!tk || !vd) throw new Error('wootly source not found'); + cookie = ''; + + if (woozCookie && wootssesCookie !== '') { + cookie = makeCookieHeader({ wooz: woozCookie, wootsses: wootssesCookie }); + } const url = await ctx.proxiedFetcher(`/grabd`, { baseUrl, query: { t: tk, id: vd }, method: 'GET', headers: { - cookie: makeCookieHeader({ wooz: woozCookie, wootsses: wootssesCookie }), + cookie, }, }); diff --git a/src/providers/sources/goojara/getEmbeds.ts b/src/providers/sources/goojara/getEmbeds.ts index 50f574a..7b26d6c 100644 --- a/src/providers/sources/goojara/getEmbeds.ts +++ b/src/providers/sources/goojara/getEmbeds.ts @@ -10,18 +10,28 @@ export async function getEmbeds(ctx: ScrapeContext, id: string): Promise $(element).attr('href')) .get() @@ -33,10 +43,7 @@ export async function getEmbeds(ctx: ScrapeContext, id: string): Promise { + $2('.seho').each((index, element) => { // Extracting the episode number as a string const episodeNumber = $2(element).find('.seep .sea').text().trim(); - console.log(episodeNumber); // Comparing with the desired episode number as a string if (parseInt(episodeNumber, 10) === media.episode.number) { const href = $2(element).find('.snfo h1 a').attr('href'); From 8e4a87421c41ea34906dc6e7b7a4512c2d2b1d70 Mon Sep 17 00:00:00 2001 From: memecornucopia Date: Sat, 17 Feb 2024 16:41:19 -0500 Subject: [PATCH 3/3] Final Fixes --- src/providers/embeds/dood.ts | 10 +++++----- src/providers/embeds/wootly.ts | 27 +++++---------------------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/src/providers/embeds/dood.ts b/src/providers/embeds/dood.ts index 7a5fba1..3dd5d05 100644 --- a/src/providers/embeds/dood.ts +++ b/src/providers/embeds/dood.ts @@ -9,7 +9,7 @@ export const doodScraper = makeEmbed({ name: 'dood', rank: 173, async scrape(ctx) { - const baseUrl = 'https://do0od.com'; + const baseUrl = 'https://d0000d.com'; const id = ctx.url.split('/d/')[1] || ctx.url.split('/e/')[1]; @@ -18,17 +18,17 @@ export const doodScraper = makeEmbed({ baseUrl, }); - const dataForLater = doodData.match(/a\+"\?token=([^"]+)/)?.[1]; + const dataForLater = doodData.match(/\?token=([^&]+)&expiry=/)?.[1]; const path = doodData.match(/\$\.get\('\/pass_md5([^']+)/)?.[1]; const doodPage = await ctx.proxiedFetcher(`/pass_md5${path}`, { headers: { - referer: `${baseUrl}/e/${id}`, + Referer: `${baseUrl}/e/${id}`, }, method: 'GET', baseUrl, }); - const downloadURL = `${doodPage}${nanoid()}?token=${dataForLater}${Date.now()}`; + const downloadURL = `${doodPage}${nanoid()}?token=${dataForLater}&expiry=${Date.now()}`; return { stream: [ @@ -42,7 +42,7 @@ export const doodScraper = makeEmbed({ type: 'mp4', url: downloadURL, headers: { - referer: 'https://do0od.com/', + Referer: 'https://d0000d.com/', }, }, }, diff --git a/src/providers/embeds/wootly.ts b/src/providers/embeds/wootly.ts index 3d75cbb..0119926 100644 --- a/src/providers/embeds/wootly.ts +++ b/src/providers/embeds/wootly.ts @@ -17,13 +17,7 @@ export const wootlyScraper = makeEmbed({ }); const cookies = parseSetCookie(wootlyData.headers.get('Set-Cookie') || ''); - let wootssesCookie = ''; - let cookie = ''; - - if (cookies && cookies.wootsses) { - wootssesCookie = cookies.wootsses.value; - cookie = makeCookieHeader({ wootsses: wootssesCookie }); - } + const wootssesCookie = cookies.wootsses.value; let $ = load(wootlyData.body); // load the html data const iframeSrc = $('iframe').attr('src') ?? ''; @@ -32,24 +26,18 @@ export const wootlyScraper = makeEmbed({ method: 'GET', readHeaders: ['Set-Cookie'], headers: { - cookie, + cookie: makeCookieHeader({ wootsses: wootssesCookie }), }, }); const woozCookies = parseSetCookie(woozCookieRequest.headers.get('Set-Cookie') || ''); - let woozCookie = ''; - cookie = ''; - - if (cookies && woozCookies.wooz) { - woozCookie = woozCookies.wooz.value; - cookie = makeCookieHeader({ wooz: woozCookie }); - } + const woozCookie = woozCookies.wooz.value; const iframeData = await ctx.proxiedFetcher(iframeSrc, { method: 'POST', body: new URLSearchParams({ qdf: '1' }), headers: { - cookie, + cookie: makeCookieHeader({ wooz: woozCookie }), Referer: iframeSrc, }, }); @@ -63,18 +51,13 @@ export const wootlyScraper = makeEmbed({ const vd = scriptText.match(/vd=([^,]+)/)?.[0].replace(/vd=|["\s]/g, ''); if (!tk || !vd) throw new Error('wootly source not found'); - cookie = ''; - - if (woozCookie && wootssesCookie !== '') { - cookie = makeCookieHeader({ wooz: woozCookie, wootsses: wootssesCookie }); - } const url = await ctx.proxiedFetcher(`/grabd`, { baseUrl, query: { t: tk, id: vd }, method: 'GET', headers: { - cookie, + cookie: makeCookieHeader({ wooz: woozCookie, wootsses: wootssesCookie }), }, });