Validate Deezer ARL when logging in

This commit is contained in:
nathom 2021-07-31 10:05:16 -07:00
parent 9c15293d44
commit af50b7f9c7

View file

@ -276,13 +276,23 @@ class ConfigCommand(Command):
self.line("<info>Credentials saved to config.</info>")
if self.option("deezer"):
from streamrip.clients import DeezerClient
from streamrip.exceptions import AuthenticationError
self.line(
"Follow the instructions at <url>https://github.com"
"/nathom/streamrip/wiki/Finding-your-Deezer-ARL-Cookie</url>"
)
config.file["deezer"]["arl"] = self.ask("Paste your ARL here: ")
config.save()
given_arl = self.ask("Paste your ARL here: ").strip()
self.line("<comment>Validating arl...</comment>")
try:
DeezerClient().login(arl=given_arl)
config.file["deezer"]["arl"] = given_arl
config.save()
self.line("<b>Sucessfully logged in!</b>")
except AuthenticationError:
self.line("<error>Could not log in. Double check your ARL</error>")
class ConvertCommand(Command):