From 94a851b9b88df3a82c8241044886fab2d81af98f Mon Sep 17 00:00:00 2001 From: calviny Date: Wed, 15 Nov 2023 22:21:14 +0800 Subject: [PATCH] fix bug when get the article --- wechatsogou/structuring.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wechatsogou/structuring.py b/wechatsogou/structuring.py index e9e321d..51ba354 100644 --- a/wechatsogou/structuring.py +++ b/wechatsogou/structuring.py @@ -171,7 +171,7 @@ def get_article_by_search(text): imgs = li.xpath('div[1]/a/img/@src') abstract = get_first_of_element(li, 'div[2]/p') time = get_first_of_element(li, 'div[2]/div/span/script/text()') - gzh_info = li.xpath('div[2]/div/a')[0] + gzh_info = li.xpath('div[2]/h3/a')[0] else: url = get_first_of_element(li, 'div/h3/a/@href') title = get_first_of_element(li, 'div/h3/a') @@ -183,7 +183,7 @@ def get_article_by_search(text): imgs.append(img) abstract = get_first_of_element(li, 'div/p') time = get_first_of_element(li, 'div/div[2]/span/script/text()') - gzh_info = li.xpath('div/div[2]/a')[0] + gzh_info = li.xpath('div/h3/a')[0] if title is not None: title = get_elem_text(title).replace("red_beg", "").replace("red_end", "")