Merge pull request #131 from taochangle/patch-2

修复抖音cookie有效性判定
This commit is contained in:
Alleria
2025-10-30 09:47:44 +08:00
committed by GitHub
+11 -8
View File
@@ -22,18 +22,21 @@ async def cookie_auth_douyin(account_file):
await page.goto("https://creator.douyin.com/creator-micro/content/upload")
try:
await page.wait_for_url("https://creator.douyin.com/creator-micro/content/upload", timeout=5000)
# 2024.06.17 抖音创作者中心改版
# 判断
# 等待“扫码登录”元素出现,超时 5 秒(如果 5 秒没出现,说明 cookie 有效)
try:
await page.get_by_text("扫码登录").wait_for(timeout=5000)
logger.error("[+] cookie 失效,需要扫码登录")
return False
except:
print("[+] 等待5秒 cookie 失效")
logger.success("[+] cookie 有效")
return True
except:
logger.error("[+] 等待5秒 cookie 失效")
await context.close()
await browser.close()
return False
# 2024.06.17 抖音创作者中心改版
if await page.get_by_text('手机号登录').count() or await page.get_by_text('扫码登录').count():
print("[+] 等待5秒 cookie 失效")
return False
else:
print("[+] cookie 有效")
return True
async def cookie_auth_tencent(account_file):
async with async_playwright() as playwright: