diff --git a/oxweb/imdb.py b/oxweb/imdb.py index d02f896..5539af7 100644 --- a/oxweb/imdb.py +++ b/oxweb/imdb.py @@ -187,18 +187,21 @@ def getMovieInfo(imdbId): def getMovieRuntimeSeconds(imdbId): info = getMovieInfo(imdbId) - value = info['runtime'][0] - parsed_value = findRe(value, '(.*?) min') - parsed_value = findRe(parsed_value, '([0-9]+)') - if not parsed_value: - parsed_value = findRe(value, '(.*?) sec') + if 'runtime' in info: + value = info['runtime'][0] + parsed_value = findRe(value, '(.*?) min') parsed_value = findRe(parsed_value, '([0-9]+)') if not parsed_value: - parsed_value = 0 + parsed_value = findRe(value, '(.*?) sec') + parsed_value = findRe(parsed_value, '([0-9]+)') + if not parsed_value: + parsed_value = 0 + else: + parsed_value = int(parsed_value) else: - parsed_value = int(parsed_value) + parsed_value = int(parsed_value) * 60 else: - parsed_value = int(parsed_value) * 60 + parsed_value = -1 return parsed_value def getMoviePoster(imdbId): @@ -325,10 +328,7 @@ def getMovieCompanyCredits(imdbId): def getMovieLocations(imdbId): url = "%slocations" % getUrlBase(imdbId) data = getUrlUnicode(url) - soup = BeautifulSoup(data) - locations = [] - for key in soup('a', {'href': re.compile('^/List')}): - locations.append(decodeHtml(key.string)) + locations = re.compile('