check if torrent site still exists

This commit is contained in:
j 2008-05-25 12:04:13 +02:00
parent 24d7378432
commit 3e9d4f357a
2 changed files with 13 additions and 0 deletions

View file

@ -10,6 +10,7 @@ from urllib import quote
from oxutils.cache import getUrl, getUrlUnicode from oxutils.cache import getUrl, getUrlUnicode
from oxutils import findRe, cache, stripTags, decodeHtml, getTorrentInfo, intValue, normalizeNewlines from oxutils import findRe, cache, stripTags, decodeHtml, getTorrentInfo, intValue, normalizeNewlines
from oxutils.normalize import normalizeImdbId from oxutils.normalize import normalizeImdbId
import oxutils
from torrent import Torrent from torrent import Torrent
@ -55,6 +56,13 @@ def getId(mininovaId):
else: else:
return mininovaId[-1] return mininovaId[-1]
def exists(mininovaId):
mininovaId = getId(mininovaId)
data = oxutils.net.getUrl("http://www.mininova.org/tor/%s" % mininovaId)
if not data or 'Torrent not found...' in data:
return False
return True
def getData(mininovaId): def getData(mininovaId):
_key_map = { _key_map = {
'by': u'uploader', 'by': u'uploader',

View file

@ -12,6 +12,7 @@ from urllib2 import URLError
from oxutils.cache import getUrl, getUrlUnicode from oxutils.cache import getUrl, getUrlUnicode
from oxutils import findRe, cache, stripTags, decodeHtml, getTorrentInfo, normalizeNewlines from oxutils import findRe, cache, stripTags, decodeHtml, getTorrentInfo, normalizeNewlines
from oxutils.normalize import normalizeImdbId from oxutils.normalize import normalizeImdbId
import oxutils
from torrent import Torrent from torrent import Torrent
@ -66,6 +67,10 @@ def getId(piratebayId):
piratebayId = d piratebayId = d
return piratebayId return piratebayId
def exists(piratebayId):
piratebayId = getId(piratebayId)
return oxutils.net.exists("http://thepiratebay.org/tor/%s" % piratebayId)
def getData(piratebayId): def getData(piratebayId):
_key_map = { _key_map = {
'spoken language(s)': u'language', 'spoken language(s)': u'language',