From 2c50156046e8784a28ce6eec910487d8c1f5f66b Mon Sep 17 00:00:00 2001 From: stratumadev Date: Mon, 14 Apr 2025 15:53:52 +0200 Subject: [PATCH 1/5] removed useless old crunchy login api endpoint --- crunchy.ts | 8 ++++---- modules/module.api-urls.ts | 7 ++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/crunchy.ts b/crunchy.ts index 1032eb3..3226215 100644 --- a/crunchy.ts +++ b/crunchy.ts @@ -265,7 +265,7 @@ export default class Crunchy implements ServiceClass { headers: {...api.crunchyAuthHeader, Authorization: `Basic ${await this.productionToken()}`}, body: authData }; - const authReq = await this.req.getData(api.beta_auth, authReqOpts); + const authReq = await this.req.getData(api.auth, authReqOpts); if(!authReq.ok || !authReq.res){ console.error('Authentication failed!'); return { isOk: false, reason: new Error('Authentication failed') }; @@ -293,7 +293,7 @@ export default class Crunchy implements ServiceClass { headers: {...api.crunchyAuthHeader, Authorization: `Basic ${await this.productionToken()}`}, body: authData }; - const authReq = await this.req.getData(api.beta_auth, authReqOpts); + const authReq = await this.req.getData(api.auth, authReqOpts); if(!authReq.ok || !authReq.res){ console.error('Anonymous Authentication failed!'); return; @@ -350,7 +350,7 @@ export default class Crunchy implements ServiceClass { headers: {...api.crunchyAuthHeader, Authorization: `Basic ${await this.productionToken()}`, Cookie: `etp_rt=${refreshToken}`}, body: authData }; - const authReq = await this.req.getData(api.beta_auth, authReqOpts); + const authReq = await this.req.getData(api.auth, authReqOpts); if(!authReq.ok || !authReq.res){ console.error('Token Authentication failed!'); if (authReq.res?.status == 400) { @@ -393,7 +393,7 @@ export default class Crunchy implements ServiceClass { headers: {...api.crunchyAuthHeader, Authorization: `Basic ${await this.productionToken()}`, Cookie: `etp_rt=${this.token.refresh_token}`}, body: authData }; - const authReq = await this.req.getData(api.beta_auth, authReqOpts); + const authReq = await this.req.getData(api.auth, authReqOpts); if(!authReq.ok || !authReq.res){ console.error('Token Refresh Failed!'); if (authReq.res?.status == 400) { diff --git a/modules/module.api-urls.ts b/modules/module.api-urls.ts index 3c61db1..8b3f1ae 100644 --- a/modules/module.api-urls.ts +++ b/modules/module.api-urls.ts @@ -24,7 +24,6 @@ export type APIType = { session: string collections: string // beta api - beta_auth: string defaultUserAgent: string, beta_profile: string beta_cmsToken: string @@ -59,14 +58,12 @@ const api: APIType = { rss_gid: `${domain.www}/syndication/feed?type=episodes&group_id=`, // &lang=enUS media_page: `${domain.www}/media-`, series_page: `${domain.www}/series-`, - auth: `${domain.www}/login`, + auth: `${domain.api_beta}/auth/v1/token`, // mobile api search3: `${domain.api}/autocomplete.0.json`, session: `${domain.api}/start_session.0.json`, collections: `${domain.api}/list_collections.0.json`, - // new api - beta_auth: `${domain.api_beta}/auth/v1/token`, - // This User-Agent bypasses Cloudflare security by the newer Endpoint + // This User-Agent bypasses Cloudflare security of the newer Endpoint defaultUserAgent: 'Crunchyroll/4.75.0 (bundle_identifier:com.crunchyroll.iphone; build_number:4100608.433889621) iOS/18.3.2 Gravity/4.75.0', beta_profile: `${domain.api_beta}/accounts/v1/me/profile`, beta_cmsToken: `${domain.api_beta}/index/v2`, From 8da0ac56c46460ea88607a86d1cfe4b6fad80a1e Mon Sep 17 00:00:00 2001 From: stratumadev Date: Mon, 14 Apr 2025 20:23:30 +0200 Subject: [PATCH 2/5] added new crunchyroll drm endpoints --- modules/module.api-urls.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/module.api-urls.ts b/modules/module.api-urls.ts index 8b3f1ae..f17e9bc 100644 --- a/modules/module.api-urls.ts +++ b/modules/module.api-urls.ts @@ -32,6 +32,8 @@ export type APIType = { beta_browse: string beta_cms: string, drm: string; + drm_widevine: string; + drm_playready: string; /** * Header */ @@ -73,6 +75,10 @@ const api: APIType = { beta_cms: `${domain.api_beta}/cms/v2`, // beta api drm: `${domain.api_beta}/drm/v1/auth`, + // new drm endpoints + drm_widevine: `${domain.www}/license/v1/license/widevine`, + // playready endpoint currently broken + drm_playready: `${domain.www}/license/v1/license/playReady`, crunchyAuthHeader: {}, //hidive API hd_apikey: '508efd7b42d546e19cc24f4d0b414e57e351ca73', From 7455d32e1d8fea33746078603e72a6d8ca482b66 Mon Sep 17 00:00:00 2001 From: stratumadev Date: Mon, 14 Apr 2025 20:24:41 +0200 Subject: [PATCH 3/5] removed never existed crunchyroll endpoint --- modules/module.api-urls.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/module.api-urls.ts b/modules/module.api-urls.ts index f17e9bc..fbc9c59 100644 --- a/modules/module.api-urls.ts +++ b/modules/module.api-urls.ts @@ -2,7 +2,6 @@ const domain = { www: 'https://www.crunchyroll.com', api: 'https://api.crunchyroll.com', - www_beta: 'https://beta.crunchyroll.com', api_beta: 'https://beta-api.crunchyroll.com', hd_www: 'https://www.hidive.com', hd_api: 'https://api.hidive.com', From fe991fecab3aae37c3109f9d771f916d19b479af Mon Sep 17 00:00:00 2001 From: stratumadev Date: Mon, 14 Apr 2025 21:59:46 +0200 Subject: [PATCH 4/5] fixed ADN movie select --- adn.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/adn.ts b/adn.ts index 8f23ffe..1947142 100644 --- a/adn.ts +++ b/adn.ts @@ -271,9 +271,8 @@ export default class AnimationDigitalNetwork implements ServiceClass { show.value.videos[episodeIndex].season = episode.season; if (!episodeNumber) { specialIndex++; - const special = show.value.videos.splice(episodeIndex, 1); - special[0].shortNumber = 'S'+specialIndex; - specials.push(...special); + episode.shortNumber = 'S'+specialIndex; + specials.push(episode); episodeIndex--; } else { console.info(` (${episode.id}) [E${episode.shortNumber}] ${episode.number} - ${episode.name}`); @@ -281,7 +280,8 @@ export default class AnimationDigitalNetwork implements ServiceClass { episodeIndex++; } for (const special of specials) { - console.info(` (${special.id}) [${special.shortNumber}] ${special.number} - ${special.name}`); + console.info(` (Special) (${special.id}) [${special.shortNumber}] ${special.number} - ${special.name}`); + show.value.videos.splice(show.value.videos.findIndex(i => i.id === special.id), 1) } show.value.videos.push(...specials); return { isOk: true, value: show.value }; From a27daa2ec647f67904d8d2938d272a9745bde6bb Mon Sep 17 00:00:00 2001 From: stratumadev Date: Mon, 14 Apr 2025 22:04:38 +0200 Subject: [PATCH 5/5] eslint my beloved --- adn.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adn.ts b/adn.ts index 1947142..60ce886 100644 --- a/adn.ts +++ b/adn.ts @@ -281,7 +281,7 @@ export default class AnimationDigitalNetwork implements ServiceClass { } for (const special of specials) { console.info(` (Special) (${special.id}) [${special.shortNumber}] ${special.number} - ${special.name}`); - show.value.videos.splice(show.value.videos.findIndex(i => i.id === special.id), 1) + show.value.videos.splice(show.value.videos.findIndex(i => i.id === special.id), 1); } show.value.videos.push(...specials); return { isOk: true, value: show.value };