Note:
- Not every movie has a cover URL. (There is no random identifier in your example.)
- Make sure you are using the latest version of IMDbPy. (IMDb is changing, and IMDbPy is with it.)
...
import imdb access = imdb.IMDb() movie = access.get_movie(1132626) print "title: %s year: %s" % (movie['title'], movie['year']) print "Cover url: %s" % movie['cover url']
If for some reason you cannot use the above, you can always use something like BeautifulSoup to get the cover URL.
from BeautifulSoup import BeautifulSoup import imdb access = imdb.IMDb() movie = access.get_movie(1132626) page = urllib2.urlopen(access.get_imdbURL(movie)) soup = BeautifulSoup(page) cover_div = soup.find(attrs={"class" : "photo"}) cover_url = (photo_div.find('img'))['src'] print "Cover url: %s" % cover_url
Tim kersten
source share