on master help sign in
[enh] paging support for piratebay
c567308asciimoo
searx/engines/piratebay.py+7−3
@@ -6,7 +6,7 @@ from urllib import quote
6categories = ['videos', 'music']
6categories = ['videos', 'music']
7
7
8url = 'https://thepiratebay.se/'
8url = 'https://thepiratebay.se/'
9−search_url = url + 'search/{search_term}/0/99/{search_type}'
9+search_url = url + 'search/{search_term}/{pageno}/99/{search_type}'
10search_types = {'videos': '200',
10search_types = {'videos': '200',
11 'music': '100',
11 'music': '100',
12 'files': '0'}
12 'files': '0'}
@@ -14,11 +14,15 @@ search_types = {'videos': '200',
14magnet_xpath = './/a[@title="Download this torrent using magnet"]'
14magnet_xpath = './/a[@title="Download this torrent using magnet"]'
15content_xpath = './/font[@class="detDesc"]//text()'
15content_xpath = './/font[@class="detDesc"]//text()'
16
16
17+paging = True
18+
17
19
18def request(query, params):
20def request(query, params):
19− search_type = search_types.get(params['category'])
21+ search_type = search_types.get(params['category'], '200')
20 params['url'] = search_url.format(search_term=quote(query),
22 params['url'] = search_url.format(search_term=quote(query),
21− search_type=search_type)
23+ search_type=search_type,
24+ pageno=params['pageno'] - 1)
25+ print params['url']
22 return params
26 return params
23
27
24
28