|
|
@ -78,9 +78,12 @@ class MetasoSpider(AbstractAiSeoSpider): |
|
|
# 抽取链接和标题 |
|
|
# 抽取链接和标题 |
|
|
a = search_item.locator("xpath=./div[1]/a") |
|
|
a = search_item.locator("xpath=./div[1]/a") |
|
|
# 抽取时间 |
|
|
# 抽取时间 |
|
|
|
|
|
try: |
|
|
publish_date_element = search_item.locator("xpath=./div[2]/div") |
|
|
publish_date_element = search_item.locator("xpath=./div[2]/div") |
|
|
publish_str = await publish_date_element.text_content() |
|
|
publish_str = await publish_date_element.text_content() |
|
|
search_result.publish_time = publish_str.replace('[', '').replace(']', '') |
|
|
search_result.publish_time = publish_str.replace('[', '').replace(']', '') |
|
|
|
|
|
except Exception as e: |
|
|
|
|
|
search_result.publish_time = '' |
|
|
if await a.is_visible(): |
|
|
if await a.is_visible(): |
|
|
search_result.title = await a.text_content() |
|
|
search_result.title = await a.text_content() |
|
|
search_result.url = await a.get_attribute('href') |
|
|
search_result.url = await a.get_attribute('href') |
|
|
|