mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-01-11 20:10:20 +00:00
better crunchyroll bypass checker
This commit is contained in:
parent
1c4801789f
commit
351a322395
2 changed files with 22 additions and 1 deletions
21
crunchy.ts
21
crunchy.ts
|
|
@ -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.');
|
||||
|
|
|
|||
|
|
@ -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`,
|
||||
|
|
|
|||
Loading…
Reference in a new issue