on master help sign in
Bing news engine corrections

XPath *never* return None. (I found the HTML report of coverage)

commit5761d6f0ab071bdae05ecef1966dd3e4cbec6eee authorCqoicebordel <Cqoicebordel@users.noreply.github.com> dateThu 29 Jan 2015, 21:19 (12 years ago) parentefde2c2
1 file changed+2−4
searx/engines/bing_news.py+2−4
searx/engines/bing_news.py+2−4
@@ -59,16 +59,14 @@ def response(resp):
5959 url = link.attrib.get('href')
6060 title = extract_text(link)
6161 contentXPath = result.xpath('.//div[@class="sn_txt"]/div//span[@class="sn_snip"]')
62− if contentXPath is not None:
63− content = escape(extract_text(contentXPath))
62+ content = escape(extract_text(contentXPath))
6463
6564 # parse publishedDate
6665 publishedDateXPath = result.xpath('.//div[@class="sn_txt"]/div'
6766 '//span[contains(@class,"sn_ST")]'
6867 '//span[contains(@class,"sn_tm")]')
6968
70− if publishedDateXPath is not None:
71− publishedDate = escape(extract_text(publishedDateXPath))
69+ publishedDate = escape(extract_text(publishedDateXPath))
7270
7371 if re.match("^[0-9]+ minute(s|) ago$", publishedDate):
7472 timeNumbers = re.findall(r'\d+', publishedDate)