better crunchyroll bypass checker

This commit is contained in:
stratumadev 2025-09-06 11:21:08 +02:00
parent 1c4801789f
commit 351a322395
2 changed files with 22 additions and 1 deletions

View file

@ -1652,8 +1652,27 @@ export default class Crunchy implements ServiceClass {
let videoStream: CrunchyPlayStream | null = null;
let audioStream: CrunchyPlayStream | null = null;
let isDLBypass: boolean = options.astream === 'android' || options.astream === 'androidtab' ? true : false;
let isDLBypassCapable: boolean = true
if (isDLBypass && !(this.token.scope as string)?.includes('offline_access')) {
if (isDLBypass) {
const me = await this.req.getData(api.me, AuthHeaders);
if (me.ok && me.res) {
const data_me = await me.res.json();
const benefits = await this.req.getData(`https://www.crunchyroll.com/subs/v1/subscriptions/${data_me.external_id}/benefits`, AuthHeaders);
if (benefits.ok && benefits.res) {
const data_benefits = await benefits.res.json() as { items: { benefit: string }[] };
if (data_benefits?.items && !data_benefits.items.find(i => i.benefit === 'offline_viewing')) {
isDLBypassCapable = false;
}
} else {
isDLBypassCapable = false;
}
} else {
isDLBypassCapable = false;
}
}
if (isDLBypass && !isDLBypassCapable) {
isDLBypass = false;
options.astream = 'androidtv';
console.warn('192 kb/s audio downloads are not available on your current Crunchyroll plan. Please upgrade to the "Mega Fan" plan to enable this feature. Falling back to 128 kb/s CBR stream.');

View file

@ -13,6 +13,7 @@ export type APIType = {
// Crunchyroll API
basic_auth_token: string;
auth: string;
me: string;
profile: string;
search: string;
content_cms: string;
@ -50,6 +51,7 @@ const api: APIType = {
// Crunchyroll API
basic_auth_token: 'cHVnMG43eW11YW9sa2tnaTNsYmo6WGlraXNhQ2FYRllCY1hxb09sa1NUMWg2b1pYbHdESk4=',
auth: `${domain.cr_www}/auth/v1/token`,
me: `${domain.cr_www}/accounts/v1/me`,
profile: `${domain.cr_www}/accounts/v1/me/profile`,
search: `${domain.cr_www}/content/v2/discover/search`,
content_cms: `${domain.cr_www}/content/v2/cms`,