diff --git a/media_platform/douyin/login.py b/media_platform/douyin/login.py index 9c9ab10..418fbe6 100644 --- a/media_platform/douyin/login.py +++ b/media_platform/douyin/login.py @@ -1,6 +1,7 @@ import sys import logging import asyncio +import functools import aioredis from tenacity import ( @@ -104,6 +105,9 @@ class DouYinLogin(AbstractLogin): sys.exit() # show login qrcode + # utils.show_qrcode(base64_qrcode_img) + partial_show_qrcode = functools.partial(utils.show_qrcode, base64_qrcode_img) + asyncio.get_running_loop().run_in_executor(executor=None, func=partial_show_qrcode) utils.show_qrcode(base64_qrcode_img) await asyncio.sleep(2) diff --git a/media_platform/xhs/login.py b/media_platform/xhs/login.py index 2377916..255649c 100644 --- a/media_platform/xhs/login.py +++ b/media_platform/xhs/login.py @@ -1,6 +1,7 @@ import sys import asyncio import logging +import functools import aioredis from tenacity import ( @@ -146,7 +147,10 @@ class XHSLogin(AbstractLogin): no_logged_in_session = cookie_dict.get("web_session") # show login qrcode - utils.show_qrcode(base64_qrcode_img) + # utils.show_qrcode(base64_qrcode_img) + partial_show_qrcode = functools.partial(utils.show_qrcode, base64_qrcode_img) + asyncio.get_running_loop().run_in_executor(executor=None, func=partial_show_qrcode) + logging.info(f"waiting for scan code login, remaining time is 20s") login_flag: bool = await self.check_login_state(no_logged_in_session) if not login_flag: