Browse Source

[enh] paging support for piratebay

asciimoo 11 years ago
parent
commit
c567308e49
1 changed files with 7 additions and 3 deletions
  1. 7
    3
      searx/engines/piratebay.py

+ 7
- 3
searx/engines/piratebay.py View File

6
 categories = ['videos', 'music']
6
 categories = ['videos', 'music']
7
 
7
 
8
 url = 'https://thepiratebay.se/'
8
 url = '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}'
10
 search_types = {'videos': '200',
10
 search_types = {'videos': '200',
11
                 'music': '100',
11
                 'music': '100',
12
                 'files': '0'}
12
                 'files': '0'}
14
 magnet_xpath = './/a[@title="Download this torrent using magnet"]'
14
 magnet_xpath = './/a[@title="Download this torrent using magnet"]'
15
 content_xpath = './/font[@class="detDesc"]//text()'
15
 content_xpath = './/font[@class="detDesc"]//text()'
16
 
16
 
17
+paging = True
18
+
17
 
19
 
18
 def request(query, params):
20
 def 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