Remove etp-rt login

This commit is contained in:
bytedream 2024-04-20 00:00:02 +02:00
parent 9bdd3aa85b
commit 8ada822396
3 changed files with 7 additions and 30 deletions

View file

@ -122,16 +122,6 @@ You can authenticate with your credentials (email:password) or by using a refres
$ crunchy-cli --credentials "email:password" <command>
```
- <span id="global-etp-rt">Refresh Token</span>
To obtain a refresh token, you have to log in at [crunchyroll.com](https://www.crunchyroll.com/) and extract the `etp_rt` cookie.
The easiest way to get it is via a browser extension which lets you export your cookies, like [Cookie-Editor](https://cookie-editor.cgagnier.ca/) ([Firefox](https://addons.mozilla.org/en-US/firefox/addon/cookie-editor/) / [Chrome](https://chrome.google.com/webstore/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm)).
When installed, look for the `etp_rt` entry and extract its value.
```shell
$ crunchy-cli --etp-rt "4ebf1690-53a4-491a-a2ac-488309120f5d" <command>
```
- <span id="global-anonymous">Stay Anonymous</span>
Login without an account (you won't be able to access premium content):
@ -226,11 +216,9 @@ The `login` command can store your session, so you don't have to authenticate ev
# save the refresh token which gets generated when login with credentials.
# your email and password won't be stored at any time on disk
$ crunchy-cli login --credentials "email:password"
# save etp-rt cookie
$ crunchy-cli login --etp-rt "4ebf1690-53a4-491a-a2ac-488309120f5d"
```
With the session stored, you do not need to pass `--credentials` / `--etp-rt` / `--anonymous` anymore when you want to execute a command.
With the session stored, you do not need to pass `--credentials` / `--anonymous` anymore when you want to execute a command.
### Download

View file

@ -326,9 +326,8 @@ async fn crunchyroll_session(
builder = builder.middleware(rate_limiter)
}
let root_login_methods_count = cli.login_method.credentials.is_some() as u8
+ cli.login_method.etp_rt.is_some() as u8
+ cli.login_method.anonymous as u8;
let root_login_methods_count =
cli.login_method.credentials.is_some() as u8 + cli.login_method.anonymous as u8;
let progress_handler = progress!("Logging in");
if root_login_methods_count == 0 {
@ -340,16 +339,16 @@ async fn crunchyroll_session(
"refresh_token" => {
return Ok(builder.login_with_refresh_token(token).await?)
}
"etp_rt" => return Ok(builder.login_with_etp_rt(token).await?),
"etp_rt" => bail!("The stored login method (etp-rt) isn't supported anymore. Please use your credentials to login"),
_ => (),
}
}
bail!("Could not read stored session ('{}')", session)
}
}
bail!("Please use a login method ('--credentials', '--etp-rt' or '--anonymous')")
bail!("Please use a login method ('--credentials' or '--anonymous')")
} else if root_login_methods_count > 1 {
bail!("Please use only one login method ('--credentials', '--etp-rt' or '--anonymous')")
bail!("Please use only one login method ('--credentials' or '--anonymous')")
}
let crunchy = if let Some(credentials) = &cli.login_method.credentials {
@ -358,8 +357,6 @@ async fn crunchyroll_session(
} else {
bail!("Invalid credentials format. Please provide your credentials as email:password")
}
} else if let Some(etp_rt) = &cli.login_method.etp_rt {
builder.login_with_etp_rt(etp_rt).await?
} else if cli.login_method.anonymous {
builder.login_anonymously().await?
} else {

View file

@ -25,9 +25,7 @@ impl Execute for Login {
SessionToken::RefreshToken(refresh_token) => {
fs::write(login_file_path, format!("refresh_token:{}", refresh_token))?
}
SessionToken::EtpRt(etp_rt) => {
fs::write(login_file_path, format!("etp_rt:{}", etp_rt))?
}
SessionToken::EtpRt(_) => bail!("Login with etp_rt isn't supported anymore. Please use your credentials to login"),
SessionToken::Anonymous => bail!("Anonymous login cannot be saved"),
}
@ -47,12 +45,6 @@ pub struct LoginMethod {
)]
#[arg(global = true, long)]
pub credentials: Option<String>,
#[arg(help = "Login with the etp-rt cookie")]
#[arg(
long_help = "Login with the etp-rt cookie. This can be obtained when you login on crunchyroll.com and extract it from there"
)]
#[arg(global = true, long)]
pub etp_rt: Option<String>,
#[arg(help = "Login anonymously / without an account")]
#[arg(global = true, long, default_value_t = false)]
pub anonymous: bool,