Showing
1 changed file
with
8 additions
and
3 deletions
| ... | @@ -49,7 +49,7 @@ async def get_sohu_cookie(account_file): | ... | @@ -49,7 +49,7 @@ async def get_sohu_cookie(account_file): |
| 49 | 'args': [ | 49 | 'args': [ |
| 50 | '--lang en-GB' | 50 | '--lang en-GB' |
| 51 | ], | 51 | ], |
| 52 | - 'headless': True, # Set headless option here | 52 | + 'headless': False, # Set headless option here |
| 53 | } | 53 | } |
| 54 | # Make sure to run headed. | 54 | # Make sure to run headed. |
| 55 | browser = await playwright.chromium.launch(**options) | 55 | browser = await playwright.chromium.launch(**options) |
| ... | @@ -63,9 +63,14 @@ async def get_sohu_cookie(account_file): | ... | @@ -63,9 +63,14 @@ async def get_sohu_cookie(account_file): |
| 63 | except: | 63 | except: |
| 64 | pass | 64 | pass |
| 65 | await asyncio.sleep(1) | 65 | await asyncio.sleep(1) |
| 66 | - await page.wait_for_selector("div.user-ico", timeout=50000) | 66 | + await page.locator("div.hd-login-logo span").nth(1).click() |
| 67 | + try: | ||
| 68 | + await page.wait_for_selector("a.hd-fBtn-userlogin img", timeout=100000) | ||
| 69 | + except: | ||
| 70 | + sohu_logger.info("登录超时") | ||
| 71 | + return | ||
| 67 | sohu_logger.info("搜狐视频登录成功") | 72 | sohu_logger.info("搜狐视频登录成功") |
| 68 | - await asyncio.sleep(3) | 73 | + await asyncio.sleep(1) |
| 69 | 74 | ||
| 70 | # await page.pause() | 75 | # await page.pause() |
| 71 | # 点击调试器的继续,保存cookie | 76 | # 点击调试器的继续,保存cookie | ... | ... |
-
Please register or login to post a comment