mirror of
https://github.com/searx/searx
synced 2024-12-12 00:45:18 +01:00
commit
c505c3c1ca
@ -10,6 +10,7 @@
|
|||||||
@parse url, title, content
|
@parse url, title, content
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import random
|
||||||
from json import loads
|
from json import loads
|
||||||
from time import time
|
from time import time
|
||||||
from lxml.html import fromstring
|
from lxml.html import fromstring
|
||||||
@ -32,7 +33,8 @@ search_string = 'search?{query}'\
|
|||||||
'&qh=0'\
|
'&qh=0'\
|
||||||
'&qlang={lang}'\
|
'&qlang={lang}'\
|
||||||
'&ff={safesearch}'\
|
'&ff={safesearch}'\
|
||||||
'&rxikd={rxikd}' # random number - 9 digits
|
'&rxieu={rxieu}'\
|
||||||
|
'&rand={rxikd}' # current unix timestamp
|
||||||
|
|
||||||
# specific xpath variables
|
# specific xpath variables
|
||||||
results_xpath = '//response//result'
|
results_xpath = '//response//result'
|
||||||
@ -59,10 +61,12 @@ def request(query, params):
|
|||||||
else:
|
else:
|
||||||
safesearch = 0
|
safesearch = 0
|
||||||
|
|
||||||
|
# rxieu is some kind of hash from the search query, but accepts random atm
|
||||||
search_path = search_string.format(query=urlencode({'q': query}),
|
search_path = search_string.format(query=urlencode({'q': query}),
|
||||||
offset=offset,
|
offset=offset,
|
||||||
number_of_results=number_of_results,
|
number_of_results=number_of_results,
|
||||||
rxikd=str(time())[:9],
|
rxikd=int(time() * 1000),
|
||||||
|
rxieu=random.randint(1000000000, 9999999999),
|
||||||
lang=language,
|
lang=language,
|
||||||
safesearch=safesearch)
|
safesearch=safesearch)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user