diff options
author | jcherqui <joachim.cherqui@viacesi.fr> | 2017-01-15 14:24:19 +0100 |
---|---|---|
committer | jcherqui <joachim.cherqui@viacesi.fr> | 2017-01-15 16:13:23 +0100 |
commit | 0549fb40d2ab0b14354e680880b0de3d9d770452 (patch) | |
tree | d851dccec3c7424d30cb5fb0830e28a6097b6f18 | |
parent | 9d9a592266ffc4f257be5c0f7519a19436672cf5 (diff) | |
download | searxng-0549fb40d2ab0b14354e680880b0de3d9d770452.tar.gz searxng-0549fb40d2ab0b14354e680880b0de3d9d770452.zip |
Add 1337x.to engine
-rw-r--r-- | searx/engines/1337x.py | 29 | ||||
-rw-r--r-- | searx/settings.yml | 4 |
2 files changed, 33 insertions, 0 deletions
diff --git a/searx/engines/1337x.py b/searx/engines/1337x.py new file mode 100644 index 000000000..8a5da9cb8 --- /dev/null +++ b/searx/engines/1337x.py @@ -0,0 +1,29 @@ +from urllib import quote +from lxml import html +from searx.engines.xpath import extract_text +from urlparse import urljoin + +url = 'https://1337x.to/' +search_url = url + 'search/{search_term}/{pageno}/' +categories = ['videos', 'music', 'files'] +paging = True + +def request(query, params): + params['url'] = search_url.format(search_term=quote(query), pageno=params['pageno']) + + return params + +def response(resp): + results = [] + + dom = html.fromstring(resp.text) + + for result in dom.xpath('//table[contains(@class, "table-list")]/tbody//tr'): + href = urljoin(url, result.xpath('./td[contains(@class, "name")]/a[2]/@href')[0]) + title = extract_text(result.xpath('./td[contains(@class, "name")]/a[2]')) + + results.append({'url': href, + 'title': title, + 'content': ''}) + + return results diff --git a/searx/settings.yml b/searx/settings.yml index 053cb4401..0ed8912cf 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -588,6 +588,10 @@ engines: timeout : 10.0 disabled : True + - name : 1337x + engine : 1337x + shortcut : 1337x + disabled : False #The blekko technology and team have joined IBM Watson! -> https://blekko.com/ # - name : blekko images |