Merge pull request #893 from stratumadev/master
Some checks are pending
auto-documentation / documentation (push) Waiting to run
build and push docker image / build-node (push) Waiting to run
Style and build test / eslint (push) Waiting to run
Style and build test / test (push) Blocked by required conditions

Fixed ADN Special listing and other optimizations
This commit is contained in:
Stratum 2025-04-15 00:49:35 +02:00 committed by GitHub
commit 8971576a25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 14 deletions

8
adn.ts
View file

@ -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 };

View file

@ -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) {

View file

@ -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',
@ -24,7 +23,6 @@ export type APIType = {
session: string
collections: string
// beta api
beta_auth: string
defaultUserAgent: string,
beta_profile: string
beta_cmsToken: string
@ -33,6 +31,8 @@ export type APIType = {
beta_browse: string
beta_cms: string,
drm: string;
drm_widevine: string;
drm_playready: string;
/**
* Header
*/
@ -59,14 +59,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`,
@ -76,6 +74,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',