Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions KickassAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import requests
import re

import urllib

# CONSTANTS
class BASE(object):
domain='kat.cr'
Expand Down Expand Up @@ -144,7 +146,6 @@ def build(self, update=True):
"""
Build and return url. Also update max_page.
"""
ret = self.base + self.query
page = "".join(("/", str(self.page), "/"))

if self.category:
Expand All @@ -157,7 +158,7 @@ def build(self, update=True):
else:
order = ""

ret = "".join((self.base, self.query, category, page, order))
ret = "".join((self.base, urllib.quote_plus(self.query), category, page, order))

if update:
self.max_page = self._get_max_page(ret)
Expand Down Expand Up @@ -234,8 +235,8 @@ def _get_torrent(self, row):
torrent_link = "http://" + BASE.domain
if td("a.cellMainLink").attr("href") is not None:
torrent_link += td("a.cellMainLink").attr("href")
magnet_link = td("a.imagnet.icon16").attr("href")
download_link = td("a.idownload.icon16").eq(1).attr("href")
magnet_link = td("a.icon16[href*='magnet']").attr("href")
download_link = td("a.icon16[href*='.torrent']").attr("href")

td_centers = row("td.center")
size = td_centers.eq(0).text()
Expand Down
1 change: 1 addition & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@