|
|
|
@ -168,7 +168,6 @@ class YiYanSpider(AbstractAiSeoSpider): |
|
|
|
)) |
|
|
|
self.ai_answer.search_result = ai_search_result_list |
|
|
|
|
|
|
|
|
|
|
|
async def check_login(self): |
|
|
|
# 找登录后才会出现的侧边栏 |
|
|
|
try: |
|
|
|
@ -182,6 +181,22 @@ class YiYanSpider(AbstractAiSeoSpider): |
|
|
|
await AiSeoApis.update_spider_session(self.session_info['id'], 2) |
|
|
|
raise Exception(f"{self.get_platform_name()}登录失败 session_id: {self.session_info['id']}") |
|
|
|
|
|
|
|
async def do_check_session(self) -> bool: |
|
|
|
try: |
|
|
|
await self.browser_page.goto(self.get_home_url(), timeout=200000) |
|
|
|
await asyncio.sleep(2) |
|
|
|
# 检查登录状态 |
|
|
|
await self.check_login() |
|
|
|
# 开始操作 |
|
|
|
chat_input_element = self.browser_page.locator("//div[@class='yc-editor']") |
|
|
|
await chat_input_element.click() |
|
|
|
await asyncio.sleep(2) |
|
|
|
# 输入提问词 |
|
|
|
await self.browser_page.keyboard.insert_text(self.prompt) |
|
|
|
return True |
|
|
|
except Exception: |
|
|
|
return False |
|
|
|
|
|
|
|
def get_platform_id(self) -> int: |
|
|
|
return 6 |
|
|
|
|
|
|
|
|