From 2389c5081130a9c9712035b03b838c3991f2f5d7 Mon Sep 17 00:00:00 2001 From: Hizkia Felix Winata Date: Tue, 4 Apr 2023 14:41:42 +0800 Subject: [PATCH] fix: parse fc2 id as int --- fc2_live_dl/fc2.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fc2_live_dl/fc2.py b/fc2_live_dl/fc2.py index 388ae97..e0211e5 100644 --- a/fc2_live_dl/fc2.py +++ b/fc2_live_dl/fc2.py @@ -247,10 +247,13 @@ async def get_websocket_url(self): control_token = json.loads( base64.b64decode(jwt_body + "==").decode("utf-8") ) - fc2id = control_token["fc2_id"] - if len(fc2id) > 0: - self._logger.debug("Logged in with ID", fc2id) - else: + try: + fc2id = control_token["fc2_id"] + if int(fc2id) > 0: + self._logger.debug("Logged in with ID", fc2id) + else: + self._logger.debug("Using anonymous account") + except: self._logger.debug("Using anonymous account") return "%(url)s?control_token=%(control_token)s" % info