From 26715695d8c16862a245592c9b56b0aa88f0b2b8 Mon Sep 17 00:00:00 2001 From: derrod Date: Wed, 6 Oct 2021 07:24:33 +0200 Subject: [PATCH] [cli] Load JSON if user pastes full response rather than just SID --- legendary/cli.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/legendary/cli.py b/legendary/cli.py index 454251c..37eebc4 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -150,7 +150,12 @@ class LegendaryCLI: print('If web page did not open automatically, please manually open the following URL: ' 'https://www.epicgames.com/id/login?redirectUrl=https://www.epicgames.com/id/api/redirect') sid = input('Please enter the "sid" value from the JSON response: ') - sid = sid.strip().strip('"') + sid = sid.strip() + if sid[0] == '{': + tmp = json.loads(sid) + sid = tmp['sid'] + else: + sid = sid.strip('"') exchange_token = self.core.auth_sid(sid) elif args.session_id: exchange_token = self.core.auth_sid(args.session_id)