forked from Icycoide/searxng
[enh] display number of results
This commit is contained in:
parent
36c8977390
commit
2f7752b410
5 changed files with 31 additions and 6 deletions
|
@ -54,6 +54,12 @@ def response(resp):
|
|||
|
||||
dom = html.fromstring(resp.text)
|
||||
|
||||
try:
|
||||
results.append({'number_of_results': int(dom.xpath('//span[@class="sb_count"]/text()')[0]
|
||||
.split()[0].replace(',', ''))})
|
||||
except:
|
||||
pass
|
||||
|
||||
# parse results
|
||||
for result in dom.xpath('//div[@class="sa_cc"]'):
|
||||
link = result.xpath('.//h3/a')[0]
|
||||
|
@ -66,10 +72,6 @@ def response(resp):
|
|||
'title': title,
|
||||
'content': content})
|
||||
|
||||
# return results if something is found
|
||||
if results:
|
||||
return results
|
||||
|
||||
# parse results again if nothing is found yet
|
||||
for result in dom.xpath('//li[@class="b_algo"]'):
|
||||
link = result.xpath('.//h2/a')[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue