diff options
author | Cqoicebordel <Cqoicebordel@users.noreply.github.com> | 2015-01-29 21:19:59 +0100 |
---|---|---|
committer | Cqoicebordel <Cqoicebordel@users.noreply.github.com> | 2015-01-29 21:19:59 +0100 |
commit | 5761d6f0ab071bdae05ecef1966dd3e4cbec6eee (patch) | |
tree | c899cdf9759d9257d3326c0850097d2cdf8c67b9 /searx/engines/bing_news.py | |
parent | efde2c21c8656ad21b24980b516ddbbf2e209523 (diff) | |
download | searxng-5761d6f0ab071bdae05ecef1966dd3e4cbec6eee.tar.gz searxng-5761d6f0ab071bdae05ecef1966dd3e4cbec6eee.zip |
Bing news engine corrections
XPath *never* return None.
(I found the HTML report of coverage)
Diffstat (limited to 'searx/engines/bing_news.py')
-rw-r--r-- | searx/engines/bing_news.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/searx/engines/bing_news.py b/searx/engines/bing_news.py index 182bd36b5..e6adb2644 100644 --- a/searx/engines/bing_news.py +++ b/searx/engines/bing_news.py @@ -59,16 +59,14 @@ def response(resp): url = link.attrib.get('href') title = extract_text(link) contentXPath = result.xpath('.//div[@class="sn_txt"]/div//span[@class="sn_snip"]') - if contentXPath is not None: - content = escape(extract_text(contentXPath)) + content = escape(extract_text(contentXPath)) # parse publishedDate publishedDateXPath = result.xpath('.//div[@class="sn_txt"]/div' '//span[contains(@class,"sn_ST")]' '//span[contains(@class,"sn_tm")]') - if publishedDateXPath is not None: - publishedDate = escape(extract_text(publishedDateXPath)) + publishedDate = escape(extract_text(publishedDateXPath)) if re.match("^[0-9]+ minute(s|) ago$", publishedDate): timeNumbers = re.findall(r'\d+', publishedDate) |