mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 04:02:00 -06:00
Remove etp-rt login
This commit is contained in:
parent
9bdd3aa85b
commit
8ada822396
3 changed files with 7 additions and 30 deletions
14
README.md
14
README.md
|
|
@ -122,16 +122,6 @@ You can authenticate with your credentials (email:password) or by using a refres
|
||||||
$ crunchy-cli --credentials "email:password" <command>
|
$ 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>
|
- <span id="global-anonymous">Stay Anonymous</span>
|
||||||
|
|
||||||
Login without an account (you won't be able to access premium content):
|
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.
|
# save the refresh token which gets generated when login with credentials.
|
||||||
# your email and password won't be stored at any time on disk
|
# your email and password won't be stored at any time on disk
|
||||||
$ crunchy-cli login --credentials "email:password"
|
$ 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
|
### Download
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -326,9 +326,8 @@ async fn crunchyroll_session(
|
||||||
builder = builder.middleware(rate_limiter)
|
builder = builder.middleware(rate_limiter)
|
||||||
}
|
}
|
||||||
|
|
||||||
let root_login_methods_count = cli.login_method.credentials.is_some() as u8
|
let root_login_methods_count =
|
||||||
+ cli.login_method.etp_rt.is_some() as u8
|
cli.login_method.credentials.is_some() as u8 + cli.login_method.anonymous as u8;
|
||||||
+ cli.login_method.anonymous as u8;
|
|
||||||
|
|
||||||
let progress_handler = progress!("Logging in");
|
let progress_handler = progress!("Logging in");
|
||||||
if root_login_methods_count == 0 {
|
if root_login_methods_count == 0 {
|
||||||
|
|
@ -340,16 +339,16 @@ async fn crunchyroll_session(
|
||||||
"refresh_token" => {
|
"refresh_token" => {
|
||||||
return Ok(builder.login_with_refresh_token(token).await?)
|
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!("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 {
|
} 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 {
|
let crunchy = if let Some(credentials) = &cli.login_method.credentials {
|
||||||
|
|
@ -358,8 +357,6 @@ async fn crunchyroll_session(
|
||||||
} else {
|
} else {
|
||||||
bail!("Invalid credentials format. Please provide your credentials as email:password")
|
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 {
|
} else if cli.login_method.anonymous {
|
||||||
builder.login_anonymously().await?
|
builder.login_anonymously().await?
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,7 @@ impl Execute for Login {
|
||||||
SessionToken::RefreshToken(refresh_token) => {
|
SessionToken::RefreshToken(refresh_token) => {
|
||||||
fs::write(login_file_path, format!("refresh_token:{}", refresh_token))?
|
fs::write(login_file_path, format!("refresh_token:{}", refresh_token))?
|
||||||
}
|
}
|
||||||
SessionToken::EtpRt(etp_rt) => {
|
SessionToken::EtpRt(_) => bail!("Login with etp_rt isn't supported anymore. Please use your credentials to login"),
|
||||||
fs::write(login_file_path, format!("etp_rt:{}", etp_rt))?
|
|
||||||
}
|
|
||||||
SessionToken::Anonymous => bail!("Anonymous login cannot be saved"),
|
SessionToken::Anonymous => bail!("Anonymous login cannot be saved"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,12 +45,6 @@ pub struct LoginMethod {
|
||||||
)]
|
)]
|
||||||
#[arg(global = true, long)]
|
#[arg(global = true, long)]
|
||||||
pub credentials: Option<String>,
|
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(help = "Login anonymously / without an account")]
|
||||||
#[arg(global = true, long, default_value_t = false)]
|
#[arg(global = true, long, default_value_t = false)]
|
||||||
pub anonymous: bool,
|
pub anonymous: bool,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue