on master help sign in
Add 1337x.to engine
commit0549fb40d2ab0b14354e680880b0de3d9d770452 authorjcherqui <joachim.cherqui@viacesi.fr> dateSun 15 Jan 2017, 14:24 (10 years ago) parent9d9a592
2 files changed+33
searx/engines/1337x.py+29 searx/settings.yml+4
searx/engines/1337x.pynew file+29
@@ -0,0 +1,29 @@
1+from urllib import quote
2+from lxml import html
3+from searx.engines.xpath import extract_text
4+from urlparse import urljoin
5+
6+url = 'https://1337x.to/'
7+search_url = url + 'search/{search_term}/{pageno}/'
8+categories = ['videos', 'music', 'files']
9+paging = True
10+
11+def request(query, params):
12+ params['url'] = search_url.format(search_term=quote(query), pageno=params['pageno'])
13+
14+ return params
15+
16+def response(resp):
17+ results = []
18+
19+ dom = html.fromstring(resp.text)
20+
21+ for result in dom.xpath('//table[contains(@class, "table-list")]/tbody//tr'):
22+ href = urljoin(url, result.xpath('./td[contains(@class, "name")]/a[2]/@href')[0])
23+ title = extract_text(result.xpath('./td[contains(@class, "name")]/a[2]'))
24+
25+ results.append({'url': href,
26+ 'title': title,
27+ 'content': ''})
28+
29+ return results
searx/settings.yml+4
@@ -588,6 +588,10 @@ engines:
588588 timeout : 10.0
589589 disabled : True
590590
591+ - name : 1337x
592+ engine : 1337x
593+ shortcut : 1337x
594+ disabled : False
591595
592596#The blekko technology and team have joined IBM Watson! -> https://blekko.com/
593597# - name : blekko images