diff --git a/ox/imdb.py b/ox/imdb.py index 18d9c19..2c1f325 100644 --- a/ox/imdb.py +++ b/ox/imdb.py @@ -18,6 +18,18 @@ from oxutils.normalize import normalizeTitle, normalizeImdbId import google +_timer = -1 +_timer_last = -1 +def debugTime(message=''): + global _timer, _timer_last + if _timer == -1: + _timer = time.time() + if _timer_last == -1: + _timer_last = time.time() + now = time.time() + print message," since last: %0.2f total time: %0.2f" % (now-_timer_last, now-_timer) + _timer_last = now + def getMovieId(title, director='', year=''): ''' >>> getMovieId('The Matrix') @@ -46,7 +58,6 @@ def getRawMovieData(imdbId): data = getMovieInfo(imdbId) data['credits'] = getMovieCredits(imdbId) data['poster'] = getMoviePoster(imdbId) - data['connections'] = getMovieConnections(imdbId) data['company credits'] = getMovieCompanyCredits(imdbId) data['filming locations'] = getMovieLocations(imdbId) data['movie connections'] = getMovieConnections(imdbId) @@ -272,28 +283,20 @@ def getMovieTrivia(imdbId): def getMovieConnections(imdbId): url = "%s/movieconnections" % getUrlBase(imdbId) - data = getUrlUnicode(url) - soup = BeautifulSoup(data) - connections = {} - content = soup('div', {'id': 'tn15content'})[0] - blocks = unicode(content).split('