dont search for ids that are not 7 digits

This commit is contained in:
j 2009-07-17 12:50:38 +02:00
parent 38e1b4ada6
commit 9a3d82da6a

View file

@ -13,6 +13,7 @@ def getId(url):
def getUrl(id): def getUrl(id):
return "http://en.wikipedia.org/wiki/%s" % id return "http://en.wikipedia.org/wiki/%s" % id
def getMovieId(title, director='', year=''): def getMovieId(title, director='', year=''):
query = '"%s" film %s %s' % (title, director, year) query = '"%s" film %s %s' % (title, director, year)
result = find(query, 1) result = find(query, 1)
@ -26,9 +27,7 @@ def getUrlByImdbId(imdbId):
if result: if result:
url = result[0][1] url = result[0][1]
return url return url
if str(imdbId).startswith('0'): return ""
imdbId = imdbId[1:]
return getUrlByImdb(imdbId)
def getUrlByImdb(imdbId): def getUrlByImdb(imdbId):
# deprecated, use getUrlByImdbId() # deprecated, use getUrlByImdbId()