diff --git a/oxweb/thepiratebay.py b/oxweb/thepiratebay.py index 6fea4e4..85d7617 100644 --- a/oxweb/thepiratebay.py +++ b/oxweb/thepiratebay.py @@ -37,7 +37,7 @@ def findMovies(query, max_results=10): url = "/" + url url = "http://thepiratebay.org" + url data = _getUrlUnicode(url) - regexp = '''(.*?).*?''' + regexp = '''(.*?).*?''' for row in re.compile(regexp, re.DOTALL).findall(data): torrentType = row[0] torrentLink = "http://thepiratebay.org" + row[1] @@ -57,13 +57,16 @@ def getId(piratebayId): if piratebayId.startswith('http://torrents.thepiratebay.org/'): piratebayId = piratebayId.split('org/')[1] d = findRe(piratebayId, "tor/(\d+)") + if d: + piratebayId = d + d = findRe(piratebayId, "torrent/(\d+)") if d: piratebayId = d return piratebayId def exists(piratebayId): piratebayId = getId(piratebayId) - return oxlib.net.exists("http://thepiratebay.org/tor/%s" % piratebayId) + return oxlib.net.exists("http://thepiratebay.org/torrent/%s" % piratebayId) def getData(piratebayId): _key_map = { @@ -77,7 +80,7 @@ def getData(piratebayId): torrent = dict() torrent[u'id'] = piratebayId torrent[u'domain'] = 'thepiratebay.org' - torrent[u'comment_link'] = 'http://thepiratebay.org/tor/%s' % piratebayId + torrent[u'comment_link'] = 'http://thepiratebay.org/torrent/%s' % piratebayId data = _getUrlUnicode(torrent['comment_link']) torrent[u'title'] = findRe(data, '(.*?) \(download torrent\) - TPB')