Skip to content

Commit 351a322

Browse files
committed
better crunchyroll bypass checker
1 parent 1c48017 commit 351a322

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

crunchy.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1652,8 +1652,27 @@ export default class Crunchy implements ServiceClass {
16521652
let videoStream: CrunchyPlayStream | null = null;
16531653
let audioStream: CrunchyPlayStream | null = null;
16541654
let isDLBypass: boolean = options.astream === 'android' || options.astream === 'androidtab' ? true : false;
1655+
let isDLBypassCapable: boolean = true
1656+
1657+
if (isDLBypass) {
1658+
const me = await this.req.getData(api.me, AuthHeaders);
1659+
if (me.ok && me.res) {
1660+
const data_me = await me.res.json();
1661+
const benefits = await this.req.getData(`https://www.crunchyroll.com/subs/v1/subscriptions/${data_me.external_id}/benefits`, AuthHeaders);
1662+
if (benefits.ok && benefits.res) {
1663+
const data_benefits = await benefits.res.json() as { items: { benefit: string }[] };
1664+
if (data_benefits?.items && !data_benefits.items.find(i => i.benefit === 'offline_viewing')) {
1665+
isDLBypassCapable = false;
1666+
}
1667+
} else {
1668+
isDLBypassCapable = false;
1669+
}
1670+
} else {
1671+
isDLBypassCapable = false;
1672+
}
1673+
}
16551674

1656-
if (isDLBypass && !(this.token.scope as string)?.includes('offline_access')) {
1675+
if (isDLBypass && !isDLBypassCapable) {
16571676
isDLBypass = false;
16581677
options.astream = 'androidtv';
16591678
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.');

modules/module.api-urls.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type APIType = {
1313
// Crunchyroll API
1414
basic_auth_token: string;
1515
auth: string;
16+
me: string;
1617
profile: string;
1718
search: string;
1819
content_cms: string;
@@ -50,6 +51,7 @@ const api: APIType = {
5051
// Crunchyroll API
5152
basic_auth_token: 'cHVnMG43eW11YW9sa2tnaTNsYmo6WGlraXNhQ2FYRllCY1hxb09sa1NUMWg2b1pYbHdESk4=',
5253
auth: `${domain.cr_www}/auth/v1/token`,
54+
me: `${domain.cr_www}/accounts/v1/me`,
5355
profile: `${domain.cr_www}/accounts/v1/me/profile`,
5456
search: `${domain.cr_www}/content/v2/discover/search`,
5557
content_cms: `${domain.cr_www}/content/v2/cms`,

0 commit comments

Comments
 (0)