diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml
index 872929d..332d6e0 100644
--- a/resources/language/English/strings.xml
+++ b/resources/language/English/strings.xml
@@ -21,7 +21,7 @@
Browse for torrent file
- Search ThePirateBay.org
+ Search ThePirateBay
Search Mininova.org
Search KickassTorrents
Searching...
diff --git a/resources/language/Russian/strings.xml b/resources/language/Russian/strings.xml
index 373426b..7db2253 100644
--- a/resources/language/Russian/strings.xml
+++ b/resources/language/Russian/strings.xml
@@ -21,7 +21,7 @@
Выбрать торрент-файл
- Искать на ThePirateBay.org
+ Искать на ThePirateBay
Искать на Mininova.org
Искать на KickassTorrents
Поиск...
diff --git a/resources/language/Spanish/strings.xml b/resources/language/Spanish/strings.xml
index 46569cb..2d11925 100644
--- a/resources/language/Spanish/strings.xml
+++ b/resources/language/Spanish/strings.xml
@@ -21,7 +21,7 @@
Buscar un archivo torrent
- Buscar en ThePirateBay.org
+ Buscar en ThePirateBay
Buscar en Mininova.org
Buscar en KickassTorrents
Buscando...
diff --git a/resources/lib/search.py b/resources/lib/search.py
index 49d9151..0369220 100644
--- a/resources/lib/search.py
+++ b/resources/lib/search.py
@@ -1,6 +1,6 @@
import re
import socket
-from urllib2 import urlopen
+from urllib2 import urlopen, URLError
from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
socket.setdefaulttimeout(15)
@@ -30,11 +30,19 @@ class Mininova(Search):
return torrents
class TPB(Search):
def __init__(self):
- self.search_uri = 'http://thepiratebay.se/search/%s/'
+ self.search_uris = ['http://thepiratebay.se/search/%s/',
+ 'http://pirateproxy.net/search/%s/']
def search(self, terms):
torrents = []
- url = self.search_uri % '+'.join(terms.split(' '))
- f = urlopen(url)
+ f = None
+ for url in [u % '+'.join(terms.split(' ')) for u in self.search_uris]:
+ try:
+ f = urlopen(url)
+ break
+ except URLError:
+ continue
+ if not f:
+ raise Exception('Out of pirate bay proxies')
soup = BeautifulSoup(f.read())
for details in soup.findAll('a', {'class': 'detLink'}):
name = details.text