File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -1652,8 +1652,27 @@ export default class Crunchy implements ServiceClass {
1652
1652
let videoStream : CrunchyPlayStream | null = null ;
1653
1653
let audioStream : CrunchyPlayStream | null = null ;
1654
1654
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
+ }
1655
1674
1656
- if ( isDLBypass && ! ( this . token . scope as string ) ?. includes ( 'offline_access' ) ) {
1675
+ if ( isDLBypass && ! isDLBypassCapable ) {
1657
1676
isDLBypass = false ;
1658
1677
options . astream = 'androidtv' ;
1659
1678
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.' ) ;
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export type APIType = {
13
13
// Crunchyroll API
14
14
basic_auth_token : string ;
15
15
auth : string ;
16
+ me : string ;
16
17
profile : string ;
17
18
search : string ;
18
19
content_cms : string ;
@@ -50,6 +51,7 @@ const api: APIType = {
50
51
// Crunchyroll API
51
52
basic_auth_token : 'cHVnMG43eW11YW9sa2tnaTNsYmo6WGlraXNhQ2FYRllCY1hxb09sa1NUMWg2b1pYbHdESk4=' ,
52
53
auth : `${ domain . cr_www } /auth/v1/token` ,
54
+ me : `${ domain . cr_www } /accounts/v1/me` ,
53
55
profile : `${ domain . cr_www } /accounts/v1/me/profile` ,
54
56
search : `${ domain . cr_www } /content/v2/discover/search` ,
55
57
content_cms : `${ domain . cr_www } /content/v2/cms` ,
You can’t perform that action at this time.
0 commit comments