Simon Bruder
2370ea9d69
All checks were successful
continuous-integration/drone/push Build is passing
31 lines
883 B
Python
31 lines
883 B
Python
from lxml import html
|
|
from searx.engines.xpath import extract_text
|
|
from searx.url_utils import quote
|
|
|
|
categories = ['files']
|
|
|
|
url = 'https://nibl.co.uk/bots.php'
|
|
search_url = url + '?search={query}'
|
|
|
|
def request(query, params):
|
|
params['url'] = search_url.format(query=quote(query))
|
|
|
|
return params
|
|
|
|
def response(resp):
|
|
results = []
|
|
|
|
dom = html.fromstring(resp.text.encode('utf-8'))
|
|
|
|
for result in dom.xpath('//tr[starts-with(@class, "botlistitem")]'):
|
|
filename = extract_text(result.xpath('td[@class="filename"]/text()'))
|
|
href = url + result.xpath('td[@class="filename"]/a/@href')[0]
|
|
filesize = result.xpath('td[@class="filesize"]/text()')[0]
|
|
|
|
results.append({'url': href,
|
|
'title': filename,
|
|
'filesize': filesize,
|
|
'template': 'file.html'})
|
|
|
|
return results
|