[fix] pep8 fix for faroo engine

This commit is contained in:
misnyo 2017-08-30 19:48:57 +02:00 committed by Adam Tauber
parent 0607b167f8
commit 20d2d4dab1

View file

@ -24,12 +24,12 @@ number_of_results = 10
# search-url # search-url
url = 'http://www.faroo.com/' url = 'http://www.faroo.com/'
search_url = url + 'instant.json?{query}'\ search_url = url + 'instant.json?{query}'\
'&start={offset}'\ '&start={offset}'\
'&length={number_of_results}'\ '&length={number_of_results}'\
'&l={language}'\ '&l={language}'\
'&src={categorie}'\ '&src={categorie}'\
'&i=false'\ '&i=false'\
'&c=false' '&c=false'
search_category = {'general': 'web', search_category = {'general': 'web',
'news': 'news'} 'news': 'news'}
@ -79,16 +79,15 @@ def response(resp):
# parse results # parse results
for result in search_res['results']: for result in search_res['results']:
publishedDate = None publishedDate = None
result_json = {'url': result['url'], result_json = {'url': result['url'], 'title': result['title'],
'title': result['title'], 'content': result['kwic']}
'content': result['kwic']}
if result['news']: if result['news']:
result_json['publishedDate'] = \ result_json['publishedDate'] = \
datetime.datetime.fromtimestamp(result['date'] / 1000.0) datetime.datetime.fromtimestamp(result['date'] / 1000.0)
# append image result if image url is set # append image result if image url is set
if result['iurl']: if result['iurl']:
result_json['template'] ='videos.html' result_json['template'] = 'videos.html'
result_json['thumbnail'] = result['iurl'] result_json['thumbnail'] = result['iurl']
results.append(result_json) results.append(result_json)