Merge pull request #148 from leordsong/bug/fix-merge-issue
Browse files- myUtils/auth.py +4 -4
myUtils/auth.py
CHANGED
|
@@ -7,7 +7,7 @@ from xhs import XhsClient
|
|
| 7 |
|
| 8 |
from conf import BASE_DIR
|
| 9 |
from utils.base_social_media import set_init_script
|
| 10 |
-
from utils.log import tencent_logger, kuaishou_logger
|
| 11 |
from pathlib import Path
|
| 12 |
from uploader.xhs_uploader.main import sign_local
|
| 13 |
|
|
@@ -27,13 +27,13 @@ async def cookie_auth_douyin(account_file):
|
|
| 27 |
# 等待“扫码登录”元素出现,超时 5 秒(如果 5 秒没出现,说明 cookie 有效)
|
| 28 |
try:
|
| 29 |
await page.get_by_text("扫码登录").wait_for(timeout=5000)
|
| 30 |
-
|
| 31 |
return False
|
| 32 |
except:
|
| 33 |
-
|
| 34 |
return True
|
| 35 |
except:
|
| 36 |
-
|
| 37 |
await context.close()
|
| 38 |
await browser.close()
|
| 39 |
return False
|
|
|
|
| 7 |
|
| 8 |
from conf import BASE_DIR
|
| 9 |
from utils.base_social_media import set_init_script
|
| 10 |
+
from utils.log import tencent_logger, kuaishou_logger, douyin_logger
|
| 11 |
from pathlib import Path
|
| 12 |
from uploader.xhs_uploader.main import sign_local
|
| 13 |
|
|
|
|
| 27 |
# 等待“扫码登录”元素出现,超时 5 秒(如果 5 秒没出现,说明 cookie 有效)
|
| 28 |
try:
|
| 29 |
await page.get_by_text("扫码登录").wait_for(timeout=5000)
|
| 30 |
+
douyin_logger.error("[+] cookie 失效,需要扫码登录")
|
| 31 |
return False
|
| 32 |
except:
|
| 33 |
+
douyin_logger.success("[+] cookie 有效")
|
| 34 |
return True
|
| 35 |
except:
|
| 36 |
+
douyin_logger.error("[+] 等待5秒 cookie 失效")
|
| 37 |
await context.close()
|
| 38 |
await browser.close()
|
| 39 |
return False
|