mirror of https://github.com/searxng/searxng.git
Hopefully fix code style errors(again)
This commit is contained in:
parent
fb364ffae7
commit
b8b23d8006
|
@ -28,16 +28,18 @@ xpath_title = './/td[3]/a[last()]'
|
||||||
xpath_torrent_links = './/td[3]/a'
|
xpath_torrent_links = './/td[3]/a'
|
||||||
xpath_filesize = './/td[4]/text()'
|
xpath_filesize = './/td[4]/text()'
|
||||||
|
|
||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
query = urlencode({'keyword': query})
|
query = urlencode({'keyword': query})
|
||||||
params['url'] = search_url.format(query=query, offset=params['pageno'])
|
params['url'] = search_url.format(query=query, offset=params['pageno'])
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
|
||||||
def response(resp):
|
def response(resp):
|
||||||
results = []
|
results = []
|
||||||
dom = html.fromstring(resp.text)
|
dom = html.fromstring(resp.text)
|
||||||
print(resp.text)
|
print(resp.text)
|
||||||
for result in dom.xpath(xpath_results):
|
for result in dom.xpath(xpath_results):
|
||||||
# defaults
|
# defaults
|
||||||
filesize = 0
|
filesize = 0
|
||||||
magnet_link = "magnet:?xt=urn:btih:{}&tr=http://tracker.acgsou.com:2710/announce"
|
magnet_link = "magnet:?xt=urn:btih:{}&tr=http://tracker.acgsou.com:2710/announce"
|
||||||
|
@ -59,12 +61,12 @@ def response(resp):
|
||||||
filesize = filesize_info[:-2]
|
filesize = filesize_info[:-2]
|
||||||
filesize_multiplier = filesize_info[-2:]
|
filesize_multiplier = filesize_info[-2:]
|
||||||
filesize = get_torrent_size(filesize, filesize_multiplier)
|
filesize = get_torrent_size(filesize, filesize_multiplier)
|
||||||
except :
|
except:
|
||||||
pass
|
pass
|
||||||
#I didn't add download/seed/leech count since as I figured out they are generated randowmly everytime
|
#I didn't add download/seed/leech count since as I figured out they are generated randowmly everytime
|
||||||
content = 'Category: "{category}".'
|
content = 'Category: "{category}".'
|
||||||
content = content.format(category=category)
|
content = content.format(category=category)
|
||||||
|
|
||||||
results.append({'url': href,
|
results.append({'url': href,
|
||||||
'title': title,
|
'title': title,
|
||||||
'content': content,
|
'content': content,
|
||||||
|
|
Loading…
Reference in New Issue