unicode needs to be encoded to utf-8 before handing to quote

This commit is contained in:
j 2008-05-28 10:45:16 +02:00
parent 454eefb7cb
commit 7d0bc860d7
1 changed files with 2 additions and 1 deletions

View File

@ -89,7 +89,8 @@ def getData(piratebayId):
return None
torrent[u'title'] = decodeHtml(torrent[u'title']).strip()
torrent[u'imdbId'] = findRe(data, 'title/tt(\d{7})')
torrent[u'torrent_link']="http://torrents.thepiratebay.org/%s/%s.torrent" % (piratebayId, quote(torrent['title']))
title = quote(torrent['title'].encode('utf-8'))
torrent[u'torrent_link']="http://torrents.thepiratebay.org/%s/%s.torrent" % (piratebayId, title)
for d in re.compile('dt>(.*?):</dt>.*?<dd.*?>(.*?)</dd>', re.DOTALL).findall(data):
key = d[0].lower().strip()
key = _key_map.get(key, key)