summaryrefslogtreecommitdiff
path: root/searx/engines/yahoo_news.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2014-03-15 20:20:41 +0100
committerAdam Tauber <asciimoo@gmail.com>2014-03-15 20:20:41 +0100
commitb735093564d7ce6f67ccac39636a842b842c1b64 (patch)
treee6597e8e8948d964fd497ee7e283921e1210858e /searx/engines/yahoo_news.py
parent1467a2e0fc860546ec2490a21db369fa50355c2e (diff)
downloadsearxng-b735093564d7ce6f67ccac39636a842b842c1b64.tar.gz
searxng-b735093564d7ce6f67ccac39636a842b842c1b64.zip
[fix] pep8
Diffstat (limited to 'searx/engines/yahoo_news.py')
-rw-r--r--searx/engines/yahoo_news.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/searx/engines/yahoo_news.py b/searx/engines/yahoo_news.py
index 13a8a6024..a1e9df59c 100644
--- a/searx/engines/yahoo_news.py
+++ b/searx/engines/yahoo_news.py
@@ -43,19 +43,26 @@ def response(resp):
publishedDate = extract_text(result.xpath(publishedDate_xpath)[0])
if re.match("^[0-9]+ minute(s|) ago$", publishedDate):
- publishedDate = datetime.now() - timedelta(minutes=int(re.match(r'\d+', publishedDate).group()))
+ publishedDate = datetime.now() - timedelta(minutes=int(re.match(r'\d+', publishedDate).group())) # noqa
else:
- if re.match("^[0-9]+ hour(s|), [0-9]+ minute(s|) ago$", publishedDate):
+ if re.match("^[0-9]+ hour(s|), [0-9]+ minute(s|) ago$",
+ publishedDate):
timeNumbers = re.findall(r'\d+', publishedDate)
- publishedDate = datetime.now() - timedelta(hours=int(timeNumbers[0])) - timedelta(minutes=int(timeNumbers[1]))
+ publishedDate = datetime.now()\
+ - timedelta(hours=int(timeNumbers[0]))\
+ - timedelta(minutes=int(timeNumbers[1]))
else:
# TODO year in string possible?
- publishedDate = datetime.strptime(publishedDate,"%b %d %H:%M%p")
+ publishedDate = datetime.strptime(publishedDate,
+ "%b %d %H:%M%p")
if publishedDate.year == 1900:
publishedDate = publishedDate.replace(year=datetime.now().year)
- results.append({'url': url, 'title': title, 'content': content,'publishedDate':publishedDate})
+ results.append({'url': url,
+ 'title': title,
+ 'content': content,
+ 'publishedDate': publishedDate})
if not suggestion_xpath:
return results