Here I present the module which provides APIs to get information about movies from IMDB.
This is about a Python implementation of IMDB API.
You don't have to download the IMDB's databases locally to use these APIs.
I have used Peteris Krumins' xgoogle library along with the BeautifulSoup to develop this in Python.
You may have to install the BeautifulSoup module (download from here) and xgoogle library (from here)
And here is the link for IMDB API
Here is a little bit of description about the usage:
from pIMDB import pIMDB
if len(sys.argv) < 2:
print "Usage: %s
sys.exit(1)
movie = re.sub(r'[^a-zA-Z0-9\']+', ' ', sys.argv[1])
imdb = pIMDB(movie)
imdb.parse_imdb_page()
print "imdb link:\n\t", imdb.imdb_link
print "\nmovie name:\n\t", imdb.movie
print "\nmovie rating:\n\t%s/%s" % (imdb.rating, imdb.outof)
print "\nmovie details:\n\t%s" % '\n\t'.join(imdb.details)
print "\nmovie storyline:\n\t%s" % imdb.storyline
It also has an API to download the poster from the IMDB website, you can use it as here:
imdb.download_poster('/tmp/destination.jpg')
That's the end of the story :)
PS: Write a comment on how you used this module
6 comments:
haha so funny that there were no comments. but this was suuuper useful. thanks & nice coding :)
Good to know it was useful... thanks
I would love to use this, but I can't get any results no matter what I try.
Eg.
python pIMDB Footloose
Yeilds 'Could not get any results from IMDB for Footloose'
Am I doing something wrong?
I think you are right ... what i think is since the google's search page has changed the scraping logic should change in xgoogle module. Let me look into the module a bit or will put my own module in its place.
I have put a patch to the xgoogle library and the pIMDB.py , do download the files freshly! it should work :)
Many Thanks works fine.
seemed to crash on "Cave Of Forgotten Dreams"
http://www.imdb.com/title/tt1664894/
Post a Comment