From 8ada8223966a6db219130f739886c9f8eedfde2b Mon Sep 17 00:00:00 2001 From: bytedream Date: Sat, 20 Apr 2024 00:00:02 +0200 Subject: [PATCH] Remove etp-rt login --- README.md | 14 +------------- crunchy-cli-core/src/lib.rs | 13 +++++-------- crunchy-cli-core/src/login/command.rs | 10 +--------- 3 files changed, 7 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 09db003..e3a0c10 100644 --- a/README.md +++ b/README.md @@ -122,16 +122,6 @@ You can authenticate with your credentials (email:password) or by using a refres $ crunchy-cli --credentials "email:password" ``` -- Refresh Token - - 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" - ``` - - Stay Anonymous 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 diff --git a/crunchy-cli-core/src/lib.rs b/crunchy-cli-core/src/lib.rs index d8d5ec5..1ec5281 100644 --- a/crunchy-cli-core/src/lib.rs +++ b/crunchy-cli-core/src/lib.rs @@ -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 { diff --git a/crunchy-cli-core/src/login/command.rs b/crunchy-cli-core/src/login/command.rs index 5642948..4da1898 100644 --- a/crunchy-cli-core/src/login/command.rs +++ b/crunchy-cli-core/src/login/command.rs @@ -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, - #[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, #[arg(help = "Login anonymously / without an account")] #[arg(global = true, long, default_value_t = false)] pub anonymous: bool,