Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #333 from dalf/piratebay
Browse files Browse the repository at this point in the history
[fix] Piratebay engine
  • Loading branch information
asciimoo committed Jun 30, 2015
2 parents 4770d21 + 36a08f2 commit 8d36a8b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
6 changes: 1 addition & 5 deletions searx/engines/piratebay.py
Expand Up @@ -20,7 +20,7 @@
paging = True

# search-url
url = 'https://thepiratebay.se/'
url = 'https://thepiratebay.am/'
search_url = url + 'search/{search_term}/{pageno}/99/{search_type}'

# piratebay specific type-definitions
Expand All @@ -42,10 +42,6 @@ def request(query, params):
search_type=search_type,
pageno=params['pageno'] - 1)

# FIX: SSLError: hostname 'kthepiratebay.se'
# doesn't match either of 'ssl2000.cloudflare.com', 'cloudflare.com', '*.cloudflare.com'
params['verify'] = False

return params


Expand Down
1 change: 1 addition & 0 deletions searx/settings.yml
Expand Up @@ -167,6 +167,7 @@ engines:
- name : piratebay
engine : piratebay
shortcut : tpb
disabled : True

- name : qwant
engine : qwant
Expand Down
6 changes: 3 additions & 3 deletions searx/tests/engines/test_piratebay.py
Expand Up @@ -15,7 +15,7 @@ def test_request(self):
params = piratebay.request(query, dicto)
self.assertIn('url', params)
self.assertIn(query, params['url'])
self.assertIn('piratebay.se', params['url'])
self.assertIn('piratebay.am', params['url'])
self.assertIn('0', params['url'])

dicto['category'] = 'music'
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_response(self):
self.assertEqual(type(results), list)
self.assertEqual(len(results), 2)
self.assertEqual(results[0]['title'], 'This is the title')
self.assertEqual(results[0]['url'], 'https://thepiratebay.se/this.is.the.link')
self.assertEqual(results[0]['url'], 'https://thepiratebay.am/this.is.the.link')
self.assertEqual(results[0]['content'], 'This is the content and should be OK')
self.assertEqual(results[0]['seed'], 13)
self.assertEqual(results[0]['leech'], 334)
Expand Down Expand Up @@ -149,7 +149,7 @@ def test_response(self):
self.assertEqual(type(results), list)
self.assertEqual(len(results), 1)
self.assertEqual(results[0]['title'], 'This is the title')
self.assertEqual(results[0]['url'], 'https://thepiratebay.se/this.is.the.link')
self.assertEqual(results[0]['url'], 'https://thepiratebay.am/this.is.the.link')
self.assertEqual(results[0]['content'], 'This is the content and should be OK')
self.assertEqual(results[0]['seed'], 0)
self.assertEqual(results[0]['leech'], 0)
Expand Down

0 comments on commit 8d36a8b

Please sign in to comment.