Showing
1 changed file
with
1 additions
and
3 deletions
| ... | @@ -25,7 +25,6 @@ async def read_cookies_from_file(file_path): | ... | @@ -25,7 +25,6 @@ async def read_cookies_from_file(file_path): |
| 25 | return [] | 25 | return [] |
| 26 | 26 | ||
| 27 | async def cookie_auth(account_file): | 27 | async def cookie_auth(account_file): |
| 28 | - print(account_file) | ||
| 29 | async with async_playwright() as playwright: | 28 | async with async_playwright() as playwright: |
| 30 | browser = await playwright.chromium.launch(headless=True) | 29 | browser = await playwright.chromium.launch(headless=True) |
| 31 | # context = await browser.new_context(storage_state=account_file) | 30 | # context = await browser.new_context(storage_state=account_file) |
| ... | @@ -35,7 +34,6 @@ async def cookie_auth(account_file): | ... | @@ -35,7 +34,6 @@ async def cookie_auth(account_file): |
| 35 | await context.add_cookies(saved_cookies) | 34 | await context.add_cookies(saved_cookies) |
| 36 | await page.goto("https://www.xiaohongshu.com") | 35 | await page.goto("https://www.xiaohongshu.com") |
| 37 | try: | 36 | try: |
| 38 | - print(await page.title()) | ||
| 39 | await page.wait_for_selector("div.link-wrapper a.link-wrapper span.channel", timeout=5000) # 等待5秒 | 37 | await page.wait_for_selector("div.link-wrapper a.link-wrapper span.channel", timeout=5000) # 等待5秒 |
| 40 | xhs_logger.success("[+] cookie 有效") | 38 | xhs_logger.success("[+] cookie 有效") |
| 41 | return True | 39 | return True |
| ... | @@ -128,7 +126,7 @@ class XHSVideo(object): | ... | @@ -128,7 +126,7 @@ class XHSVideo(object): |
| 128 | 126 | ||
| 129 | 127 | ||
| 130 | xhs_logger.info("正在填充标题和话题...") | 128 | xhs_logger.info("正在填充标题和话题...") |
| 131 | - await page.locator("div.titleInput div div input").fill("花花") | 129 | + await page.locator("div.titleInput div div input").fill(self.title) |
| 132 | 130 | ||
| 133 | inputTag = page.locator('id=quillEditor').locator('div p') | 131 | inputTag = page.locator('id=quillEditor').locator('div p') |
| 134 | await inputTag.click() | 132 | await inputTag.click() | ... | ... |
-
Please register or login to post a comment