Skip to content

Commit

Permalink
[CR] Migrate to android token
Browse files Browse the repository at this point in the history
Will require a fresh login.
Web wasn't working for password auth, for some reason.

Increment version
  • Loading branch information
AnimeDL committed Jun 24, 2024
1 parent ff978e2 commit 0a7cfcd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions crunchy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export default class Crunchy implements ServiceClass {
}).toString();
const authReqOpts: reqModule.Params = {
method: 'POST',
headers: api.crunchyAuthHeader,
headers: api.crunchyAuthHeaderMob,
body: authData
};
const authReq = await this.req.getData(api.beta_auth, authReqOpts);
Expand All @@ -256,7 +256,7 @@ export default class Crunchy implements ServiceClass {
}).toString();
const authReqOpts: reqModule.Params = {
method: 'POST',
headers: api.crunchyAuthHeader,
headers: api.crunchyAuthHeaderMob,
body: authData
};
const authReq = await this.req.getData(api.beta_auth, authReqOpts);
Expand Down Expand Up @@ -300,12 +300,14 @@ export default class Crunchy implements ServiceClass {

public async loginWithToken(refreshToken: string) {
const authData = new URLSearchParams({
'grant_type': 'etp_rt_cookie',
'refresh_token': this.token.refresh_token,
'grant_type': 'refresh_token',
//'grant_type': 'etp_rt_cookie',
'scope': 'offline_access'
}).toString();
const authReqOpts: reqModule.Params = {
method: 'POST',
headers: {...api.crunchyAuthHeader, Cookie: `etp_rt=${refreshToken}`},
headers: {...api.crunchyAuthHeaderMob, Cookie: `etp_rt=${refreshToken}`},
body: authData
};
const authReq = await this.req.getData(api.beta_auth, authReqOpts);
Expand Down Expand Up @@ -336,12 +338,14 @@ export default class Crunchy implements ServiceClass {
//console.info('[WARN] The token has expired compleatly. I will try to refresh the token anyway, but you might have to reauth.');
}
const authData = new URLSearchParams({
'grant_type': 'etp_rt_cookie',
'refresh_token': this.token.refresh_token,
'grant_type': 'refresh_token',
//'grant_type': 'etp_rt_cookie',
'scope': 'offline_access'
}).toString();
const authReqOpts: reqModule.Params = {
method: 'POST',
headers: {...api.crunchyAuthHeader, Cookie: `etp_rt=${this.token.refresh_token}`},
headers: {...api.crunchyAuthHeaderMob, Cookie: `etp_rt=${this.token.refresh_token}`},
body: authData
};
const authReq = await this.req.getData(api.beta_auth, authReqOpts);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "multi-downloader-nx",
"short_name": "aniDL",
"version": "5.1.0b5",
"version": "5.1.0",
"description": "Downloader for Crunchyroll, Hidive, AnimeOnegai, and AnimationDigitalNetwork with CLI and GUI",
"keywords": [
"download",
Expand Down

0 comments on commit 0a7cfcd

Please sign in to comment.