From af50b7f9c70604c469ad7ce4bcfa52b8a5959d16 Mon Sep 17 00:00:00 2001 From: nathom Date: Sat, 31 Jul 2021 10:05:16 -0700 Subject: [PATCH] Validate Deezer ARL when logging in --- rip/cli.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/rip/cli.py b/rip/cli.py index d87a073..b9abda1 100644 --- a/rip/cli.py +++ b/rip/cli.py @@ -276,13 +276,23 @@ class ConfigCommand(Command): self.line("Credentials saved to config.") if self.option("deezer"): + from streamrip.clients import DeezerClient + from streamrip.exceptions import AuthenticationError + self.line( "Follow the instructions at https://github.com" "/nathom/streamrip/wiki/Finding-your-Deezer-ARL-Cookie" ) - config.file["deezer"]["arl"] = self.ask("Paste your ARL here: ") - config.save() + given_arl = self.ask("Paste your ARL here: ").strip() + self.line("Validating arl...") + try: + DeezerClient().login(arl=given_arl) + config.file["deezer"]["arl"] = given_arl + config.save() + self.line("Sucessfully logged in!") + except AuthenticationError: + self.line("Could not log in. Double check your ARL") class ConvertCommand(Command):