forked from Ponysearch/Ponysearch
[enh] add result number parsing to google engine
This commit is contained in:
parent
42606f53dd
commit
52d1087202
1 changed files with 6 additions and 0 deletions
|
@ -221,6 +221,12 @@ def response(resp):
|
||||||
instant_answer = dom.xpath('//div[@id="_vBb"]//text()')
|
instant_answer = dom.xpath('//div[@id="_vBb"]//text()')
|
||||||
if instant_answer:
|
if instant_answer:
|
||||||
results.append({'answer': u' '.join(instant_answer)})
|
results.append({'answer': u' '.join(instant_answer)})
|
||||||
|
try:
|
||||||
|
results_num = int(dom.xpath('//div[@id="resultStats"]//text()')[0]
|
||||||
|
.split()[1].replace(',', ''))
|
||||||
|
results.append({'number_of_results': results_num})
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# parse results
|
# parse results
|
||||||
for result in dom.xpath(results_xpath):
|
for result in dom.xpath(results_xpath):
|
||||||
|
|
Loading…
Reference in a new issue