kickass: Use https

This commit is contained in:
Laurent Bachelier 2013-03-29 20:20:36 +01:00
commit 2822006104
2 changed files with 8 additions and 8 deletions

View file

@ -28,25 +28,25 @@ __all__ = ['KickassBrowser']
class KickassBrowser(BaseBrowser): class KickassBrowser(BaseBrowser):
DOMAIN = 'ka.tt' DOMAIN = 'ka.tt'
PROTOCOL = 'http' PROTOCOL = 'https'
ENCODING = 'utf-8' ENCODING = 'utf-8'
USER_AGENT = BaseBrowser.USER_AGENTS['wget'] USER_AGENT = BaseBrowser.USER_AGENTS['wget']
PAGES = { PAGES = {
'http://ka.tt/usearch/.*field=seeders&sorder=desc': TorrentsPage, 'https://ka.tt/usearch/.*field=seeders&sorder=desc': TorrentsPage,
'http://ka.tt/.*.html': TorrentPage, 'https://ka.tt/.*.html': TorrentPage,
} }
def home(self): def home(self):
return self.location('http://ka.tt/') return self.location('https://ka.tt/')
def iter_torrents(self, pattern): def iter_torrents(self, pattern):
self.location('http://ka.tt/usearch/%s/?field=seeders&sorder=desc' % pattern.encode('utf-8')) self.location('https://ka.tt/usearch/%s/?field=seeders&sorder=desc' % pattern.encode('utf-8'))
assert self.is_on_page(TorrentsPage) assert self.is_on_page(TorrentsPage)
return self.page.iter_torrents() return self.page.iter_torrents()
def get_torrent(self, id): def get_torrent(self, id):
try: try:
self.location('http://ka.tt/%s.html' % id) self.location('https://ka.tt/%s.html' % id)
except BrowserHTTPNotFound: except BrowserHTTPNotFound:
return return
if self.is_on_page(TorrentPage): if self.is_on_page(TorrentPage):

View file

@ -60,7 +60,7 @@ class TorrentsPage(BasePage):
elif href.startswith('http'): elif href.startswith('http'):
url = unicode(href) url = unicode(href)
elif href.startswith('//'): elif href.startswith('//'):
url = u'http:%s' % href url = u'https:%s' % href
size = tr.getchildren()[1].text size = tr.getchildren()[1].text
u = tr.getchildren()[1].getchildren()[0].text u = tr.getchildren()[1].getchildren()[0].text
@ -116,7 +116,7 @@ class TorrentPage(BasePage):
if href.startswith('magnet'): if href.startswith('magnet'):
magnet = unicode(href) magnet = unicode(href)
elif href.startswith('//'): elif href.startswith('//'):
url = u'http:%s' % href url = u'https:%s' % href
elif href.startswith('http'): elif href.startswith('http'):
url = unicode(href) url = unicode(href)