From 3c826458371080ab72aa6b2e158253d0536ea5c1 Mon Sep 17 00:00:00 2001
From: j <0x006A@0x2620.org>
Date: Mon, 10 Nov 2008 18:34:56 +0100
Subject: [PATCH] tpb changed its urls
---
oxweb/thepiratebay.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
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')