# -*- coding: UTF-8 -*- # vi:si:et:sw=4:sts=4:ts=4 import re from oxlib.cache import getHeaders, getUrl, getUrlUnicode from oxlib import findRe, stripTags def getUrlByImdb(imdb): #this would also wor but does not cache: ''' from urllib2 import urlopen u = urlopen(url) return u.url ''' url = "http://www.rottentomatoes.com/alias?type=imdbid&s=%s" % imdb data = getUrl(url) if "movie_title" in data: movies = re.compile('(/m/.*?/)').findall(data) if movies: return "http://www.rottentomatoes.com" + movies[0] return None def getData(url): data = getUrlUnicode(url) r = {} r['title'] = findRe(data, '