From 69da27d6dca12b2c0497952fb9521fd933204650 Mon Sep 17 00:00:00 2001 From: Joris te Dorsthorst <6518350+Joristdh@users.noreply.github.com> Date: Thu, 1 Feb 2024 11:19:02 +0100 Subject: [PATCH 01/17] Strip native language suffix from caption label --- src/providers/embeds/upcloud.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/embeds/upcloud.ts b/src/providers/embeds/upcloud.ts index 0f86cd0..663bb3d 100644 --- a/src/providers/embeds/upcloud.ts +++ b/src/providers/embeds/upcloud.ts @@ -110,7 +110,7 @@ export const upcloudScraper = makeEmbed({ if (track.kind !== 'captions') return; const type = getCaptionTypeFromUrl(track.file); if (!type) return; - const language = labelToLanguageCode(track.label); + const language = labelToLanguageCode(track.label.split(' ')[0]); if (!language) return; captions.push({ id: track.file, From ccb029db1db2cf9ad5ce26f54c7469521bd0aa91 Mon Sep 17 00:00:00 2001 From: memecornucopia Date: Thu, 1 Feb 2024 12:19:28 -0500 Subject: [PATCH 02/17] 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 03/17] 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 04/17] 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 }), }, }); From 66b27ef21ee67f5aa39da33338c33e241922f8a3 Mon Sep 17 00:00:00 2001 From: Screeching Bagel Date: Sun, 25 Feb 2024 17:33:53 -0800 Subject: [PATCH 05/17] update docs links in README.md updated to https://movie-web.github.io/providers/ --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a0cadad..ebc7991 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ features: - scrape popular streaming websites - works in both browser and server-side -Visit documentation here: https://providers.docs.movie-web.app/ +Visit documentation here: https://movie-web.github.io/providers/ ## How to run locally or test my changes -These topics are also covered in the documentation, [read about it here](https://providers.docs.movie-web.app/extra-topics/development). +These topics are also covered in the documentation, [read about it here](https://movie-web.github.io/providers/extra-topics/development). From e0bb7d5a3010a0b2e8da699a02019b431be6a05a Mon Sep 17 00:00:00 2001 From: Screeching Bagel Date: Mon, 26 Feb 2024 01:02:48 -0800 Subject: [PATCH 06/17] Update 0.usage-on-x.md another mention --- .docs/content/2.essentials/0.usage-on-x.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docs/content/2.essentials/0.usage-on-x.md b/.docs/content/2.essentials/0.usage-on-x.md index 5294be4..0c7443d 100644 --- a/.docs/content/2.essentials/0.usage-on-x.md +++ b/.docs/content/2.essentials/0.usage-on-x.md @@ -17,7 +17,7 @@ import { makeProviders, makeStandardFetcher, targets } from '@movie-web/provider const providers = makeProviders({ fetcher: makeStandardFetcher(fetch), - target: chooseYourself, // check out https://providers.docs.movie-web.app/essentials/targets + target: chooseYourself, // check out https://movie-web.github.io/providers/essentials/targets }) ``` From ad2ee21c00ac3993cf47a1641aa59bd1224235b0 Mon Sep 17 00:00:00 2001 From: Screeching Bagel Date: Mon, 26 Feb 2024 01:17:28 -0800 Subject: [PATCH 07/17] Update SECURITY.md (#1) updated the discord link, but the rest needs more thought --- .github/SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/SECURITY.md b/.github/SECURITY.md index c8ee568..11b0a2a 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -11,4 +11,4 @@ Support is not provided for any forks or mirrors of movie-web. There are two ways you can contact the movie-web maintainers to report a vulnerability: - Email [security@movie-web.app](mailto:security@movie-web.app) - - Report the vulnerability in the [movie-web Discord server](https://discord.movie-web.app) + - Report the vulnerability in the [movie-web Discord server](https://discord.gg/gQYB6fGArX) From b5dcd7d1339333133fee8b7ee558b6e1b5cb1711 Mon Sep 17 00:00:00 2001 From: Screeching Bagel Date: Mon, 26 Feb 2024 01:18:53 -0800 Subject: [PATCH 08/17] Update 0.introduction.md (#2) another mention but i did take some liberty with that one --- .docs/content/1.get-started/0.introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docs/content/1.get-started/0.introduction.md b/.docs/content/1.get-started/0.introduction.md index eb21056..6807b20 100644 --- a/.docs/content/1.get-started/0.introduction.md +++ b/.docs/content/1.get-started/0.introduction.md @@ -2,7 +2,7 @@ ## What is `@movie-web/providers`? -`@movie-web/providers` is the soul of [movie-web.app](https://movie-web.app). It's a collection of scrapers of various streaming sites. It extracts the raw streams from those sites, so you can watch them without any extra fluff from the original sites. +`@movie-web/providers` is the soul of [movie-web](https://github.com/movie-web/movie-web). It's a collection of scrapers of various streaming sites. It extracts the raw streams from those sites, so you can watch them without any extra fluff from the original sites. ## What can I use this on? From 5df9123edb518c26bb3dc0315a2b1c0c1740ba70 Mon Sep 17 00:00:00 2001 From: Screeching Bagel Date: Mon, 26 Feb 2024 01:19:48 -0800 Subject: [PATCH 09/17] Update package.json (#3) anotherr mention --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b71320..df4367e 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "bugs": { "url": "https://github.com/movie-web/providers/issues" }, - "homepage": "https://providers.docs.movie-web.app/", + "homepage": "https://movie-web.github.io/providers/", "scripts": { "build": "vite build && tsc --noEmit", "cli": "ts-node ./src/dev-cli/index.ts", From 85cb75154290d2a7a10e1b75e6cce3f740811c1d Mon Sep 17 00:00:00 2001 From: thehairy <71461991+thehairy@users.noreply.github.com> Date: Tue, 27 Feb 2024 21:16:32 +0100 Subject: [PATCH 10/17] Update sendRequest.ts --- src/providers/sources/showbox/sendRequest.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/providers/sources/showbox/sendRequest.ts b/src/providers/sources/showbox/sendRequest.ts index 7ea9024..6923a3c 100644 --- a/src/providers/sources/showbox/sendRequest.ts +++ b/src/providers/sources/showbox/sendRequest.ts @@ -34,13 +34,14 @@ export const sendRequest = async (ctx: ScrapeContext, data: object, altApi = fal }); const base64body = btoa(body); - const formatted = new URLSearchParams(); - formatted.append('data', base64body); - formatted.append('appid', '27'); - formatted.append('platform', 'android'); - formatted.append('version', '129'); - formatted.append('medium', 'Website'); - formatted.append('token', randomId(32)); + const formatted = { + 'data': base64body, + 'appid': '27', + 'platform': 'android', + 'version': '129', + 'medium': 'Website', + 'token': randomId(32) + }; const requestUrl = altApi ? apiUrls[1] : apiUrls[0]; @@ -51,7 +52,7 @@ export const sendRequest = async (ctx: ScrapeContext, data: object, altApi = fal 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'okhttp/3.2.0', }, - body: formatted, + body: Object.entries(formatted).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join('&'), }); return JSON.parse(response); }; From f47a2b0f40c5a9bf6a6d596b3d845287fdd9b3be Mon Sep 17 00:00:00 2001 From: thehairy Date: Tue, 27 Feb 2024 22:26:43 +0100 Subject: [PATCH 11/17] move showbox fix to util function --- src/providers/sources/showbox/sendRequest.ts | 15 ++++++++------- src/utils/params.ts | 5 +++++ 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 src/utils/params.ts diff --git a/src/providers/sources/showbox/sendRequest.ts b/src/providers/sources/showbox/sendRequest.ts index 6923a3c..248fddd 100644 --- a/src/providers/sources/showbox/sendRequest.ts +++ b/src/providers/sources/showbox/sendRequest.ts @@ -2,6 +2,7 @@ import CryptoJS from 'crypto-js'; import { customAlphabet } from 'nanoid'; import type { ScrapeContext } from '@/utils/context'; +import { createSearchParams } from '@/utils/params'; import { apiUrls, appId, appKey, key } from './common'; import { encrypt, getVerify } from './crypto'; @@ -35,12 +36,12 @@ export const sendRequest = async (ctx: ScrapeContext, data: object, altApi = fal const base64body = btoa(body); const formatted = { - 'data': base64body, - 'appid': '27', - 'platform': 'android', - 'version': '129', - 'medium': 'Website', - 'token': randomId(32) + data: base64body, + appid: '27', + platform: 'android', + version: '129', + medium: 'Website', + token: randomId(32), }; const requestUrl = altApi ? apiUrls[1] : apiUrls[0]; @@ -52,7 +53,7 @@ export const sendRequest = async (ctx: ScrapeContext, data: object, altApi = fal 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'okhttp/3.2.0', }, - body: Object.entries(formatted).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join('&'), + body: createSearchParams(formatted), }); return JSON.parse(response); }; diff --git a/src/utils/params.ts b/src/utils/params.ts new file mode 100644 index 0000000..ea2149f --- /dev/null +++ b/src/utils/params.ts @@ -0,0 +1,5 @@ +export function createSearchParams(params: { [key: string]: string | number }): string { + return Object.entries(params) + .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`) + .join('&'); +} From b2f372fbb979fe9ef03fb0a5dc20317f73cb5c03 Mon Sep 17 00:00:00 2001 From: Jorrin <43169049+JorrinKievit@users.noreply.github.com> Date: Wed, 28 Feb 2024 00:02:21 +0100 Subject: [PATCH 12/17] fix ridomovies not working for some sources --- package-lock.json | 4 ++-- src/providers/sources/ridomovies/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1fc4ea9..3b07825 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@movie-web/providers", - "version": "2.2.0", + "version": "2.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@movie-web/providers", - "version": "2.2.0", + "version": "2.2.1", "license": "MIT", "dependencies": { "cheerio": "^1.0.0-rc.12", diff --git a/src/providers/sources/ridomovies/index.ts b/src/providers/sources/ridomovies/index.ts index f028875..fba442a 100644 --- a/src/providers/sources/ridomovies/index.ts +++ b/src/providers/sources/ridomovies/index.ts @@ -28,9 +28,9 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) => const showPageResult = await ctx.proxiedFetcher(`/${show.fullSlug}`, { baseUrl: ridoMoviesBase, }); - const fullEpisodeSlug = `${show.fullSlug}/season-${ctx.media.season.number}/episode-${ctx.media.episode.number}`; + const fullEpisodeSlug = `season-${ctx.media.season.number}/episode-${ctx.media.episode.number}`; const regexPattern = new RegExp( - `\\\\"id\\\\":\\\\"(\\d+)\\\\"(?=.*?\\\\\\"fullSlug\\\\\\":\\\\\\"${fullEpisodeSlug}\\\\\\")`, + `\\\\"id\\\\":\\\\"(\\d+)\\\\"(?=.*?\\\\\\"fullSlug\\\\\\":\\\\\\"[^"]*${fullEpisodeSlug}[^"]*\\\\\\")`, 'g', ); const matches = [...showPageResult.matchAll(regexPattern)]; From 36d4b41baa65dbd7669a1f989ec6e6be6b859896 Mon Sep 17 00:00:00 2001 From: Jorrin <43169049+JorrinKievit@users.noreply.github.com> Date: Thu, 29 Feb 2024 22:44:38 +0100 Subject: [PATCH 13/17] Fix URLSearchParams usage for react-native --- src/fetchers/body.ts | 10 +++++++++- src/providers/sources/showbox/sendRequest.ts | 18 ++++++++---------- src/utils/native.ts | 9 +++++++++ src/utils/params.ts | 5 ----- 4 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 src/utils/native.ts delete mode 100644 src/utils/params.ts diff --git a/src/fetchers/body.ts b/src/fetchers/body.ts index 44438e5..2d9d219 100644 --- a/src/fetchers/body.ts +++ b/src/fetchers/body.ts @@ -1,6 +1,7 @@ import FormData from 'form-data'; import { FetcherOptions } from '@/fetchers/types'; +import { isReactNative } from '@/utils/native'; export interface SeralizedBody { headers: Record; @@ -8,11 +9,18 @@ export interface SeralizedBody { } export function serializeBody(body: FetcherOptions['body']): SeralizedBody { - if (body === undefined || typeof body === 'string' || body instanceof URLSearchParams || body instanceof FormData) + if (body === undefined || typeof body === 'string' || body instanceof URLSearchParams || body instanceof FormData) { + if (body instanceof URLSearchParams && isReactNative()) { + return { + headers: {}, + body: body.toString(), + }; + } return { headers: {}, body, }; + } // serialize as JSON return { diff --git a/src/providers/sources/showbox/sendRequest.ts b/src/providers/sources/showbox/sendRequest.ts index 248fddd..7ea9024 100644 --- a/src/providers/sources/showbox/sendRequest.ts +++ b/src/providers/sources/showbox/sendRequest.ts @@ -2,7 +2,6 @@ import CryptoJS from 'crypto-js'; import { customAlphabet } from 'nanoid'; import type { ScrapeContext } from '@/utils/context'; -import { createSearchParams } from '@/utils/params'; import { apiUrls, appId, appKey, key } from './common'; import { encrypt, getVerify } from './crypto'; @@ -35,14 +34,13 @@ export const sendRequest = async (ctx: ScrapeContext, data: object, altApi = fal }); const base64body = btoa(body); - const formatted = { - data: base64body, - appid: '27', - platform: 'android', - version: '129', - medium: 'Website', - token: randomId(32), - }; + const formatted = new URLSearchParams(); + formatted.append('data', base64body); + formatted.append('appid', '27'); + formatted.append('platform', 'android'); + formatted.append('version', '129'); + formatted.append('medium', 'Website'); + formatted.append('token', randomId(32)); const requestUrl = altApi ? apiUrls[1] : apiUrls[0]; @@ -53,7 +51,7 @@ export const sendRequest = async (ctx: ScrapeContext, data: object, altApi = fal 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'okhttp/3.2.0', }, - body: createSearchParams(formatted), + body: formatted, }); return JSON.parse(response); }; diff --git a/src/utils/native.ts b/src/utils/native.ts new file mode 100644 index 0000000..cc91cdb --- /dev/null +++ b/src/utils/native.ts @@ -0,0 +1,9 @@ +export const isReactNative = () => { + try { + // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires + require('react-native'); + return true; + } catch (e) { + return false; + } +}; diff --git a/src/utils/params.ts b/src/utils/params.ts deleted file mode 100644 index ea2149f..0000000 --- a/src/utils/params.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function createSearchParams(params: { [key: string]: string | number }): string { - return Object.entries(params) - .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`) - .join('&'); -} From b0da041ba998ee8b07dda61a362348cfbad6a421 Mon Sep 17 00:00:00 2001 From: Jorrin <43169049+JorrinKievit@users.noreply.github.com> Date: Thu, 29 Feb 2024 23:11:11 +0100 Subject: [PATCH 14/17] set header for urlsearchparams request --- src/fetchers/body.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fetchers/body.ts b/src/fetchers/body.ts index 2d9d219..c859a2a 100644 --- a/src/fetchers/body.ts +++ b/src/fetchers/body.ts @@ -12,7 +12,9 @@ export function serializeBody(body: FetcherOptions['body']): SeralizedBody { if (body === undefined || typeof body === 'string' || body instanceof URLSearchParams || body instanceof FormData) { if (body instanceof URLSearchParams && isReactNative()) { return { - headers: {}, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, body: body.toString(), }; } From 70f70475df5cf10bc3e836f89dd7c61b375fde2d Mon Sep 17 00:00:00 2001 From: Jorrin <43169049+JorrinKievit@users.noreply.github.com> Date: Thu, 29 Feb 2024 23:59:50 +0100 Subject: [PATCH 15/17] bump version + changelog --- .docs/content/1.get-started/4.changelog.md | 5 +++++ package-lock.json | 4 ++-- package.json | 2 +- src/providers/embeds/dood.ts | 6 +++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.docs/content/1.get-started/4.changelog.md b/.docs/content/1.get-started/4.changelog.md index 9464b1e..32ec9a5 100644 --- a/.docs/content/1.get-started/4.changelog.md +++ b/.docs/content/1.get-started/4.changelog.md @@ -2,6 +2,11 @@ title: 'Changelog' --- +# Version 2.2.2 +- Remove references to the old domain +- Fixed ridomovies not working for some shows and movies +- Fixed Showbox not working in react-native. + # Version 2.2.1 - Fixed Closeload scraper diff --git a/package-lock.json b/package-lock.json index 3b07825..d73ef35 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@movie-web/providers", - "version": "2.2.1", + "version": "2.2.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@movie-web/providers", - "version": "2.2.1", + "version": "2.2.2", "license": "MIT", "dependencies": { "cheerio": "^1.0.0-rc.12", diff --git a/package.json b/package.json index df4367e..04e2a99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@movie-web/providers", - "version": "2.2.1", + "version": "2.2.2", "description": "Package that contains all the providers of movie-web", "main": "./lib/index.umd.js", "types": "./lib/index.d.ts", diff --git a/src/providers/embeds/dood.ts b/src/providers/embeds/dood.ts index 3dd5d05..4eff019 100644 --- a/src/providers/embeds/dood.ts +++ b/src/providers/embeds/dood.ts @@ -41,11 +41,11 @@ export const doodScraper = makeEmbed({ unknown: { type: 'mp4', url: downloadURL, - headers: { - Referer: 'https://d0000d.com/', - }, }, }, + headers: { + Referer: 'https://d0000d.com/', + }, }, ], }; From d89b189b9ef455d3d96239996c5d7a9d19d5a6e0 Mon Sep 17 00:00:00 2001 From: Jorrin <43169049+JorrinKievit@users.noreply.github.com> Date: Fri, 1 Mar 2024 00:04:30 +0100 Subject: [PATCH 16/17] add one more fix in the changelog --- .docs/content/1.get-started/4.changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.docs/content/1.get-started/4.changelog.md b/.docs/content/1.get-started/4.changelog.md index 32ec9a5..a9d6f33 100644 --- a/.docs/content/1.get-started/4.changelog.md +++ b/.docs/content/1.get-started/4.changelog.md @@ -3,6 +3,7 @@ title: 'Changelog' --- # Version 2.2.2 +- Fix subtitles not appearing if the name of the subtitle is in its native tongue. - Remove references to the old domain - Fixed ridomovies not working for some shows and movies - Fixed Showbox not working in react-native. From 02d8e475f2a03aa8b32febd6357293c70707259d Mon Sep 17 00:00:00 2001 From: William Oldham Date: Thu, 29 Feb 2024 23:04:31 +0000 Subject: [PATCH 17/17] Update discord link in SECURITY.MD --- .github/SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 11b0a2a..5854baf 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -11,4 +11,4 @@ Support is not provided for any forks or mirrors of movie-web. There are two ways you can contact the movie-web maintainers to report a vulnerability: - Email [security@movie-web.app](mailto:security@movie-web.app) - - Report the vulnerability in the [movie-web Discord server](https://discord.gg/gQYB6fGArX) + - Report the vulnerability in the [movie-web Discord server](https://movie-web.github.io/links/discord)