Git Product home page Git Product logo

imdb_api_python's Introduction

IMDB_Api_python

PyPI

Install

pip install IMDBAPI

windows

py -m pip install IMDBAPI

with setup.py

py setup.py install

API

getRating(movieName ):

	which returns the rating of the requsted movie by passing Movie Name as a parameter

getRatingByImdbId(IMDB_ID ):

	which returns the rating of the requsted movie by IMDB ID as a prameter

getDirector(movieName):

	which returns the Directors name of the requsted movie by passing Movie Name as a parameter

getDirectorByImdbId(IMDB_ID ):

	which returns the Directors name of the requsted movie by IMDB ID as a prameter

getCasting(movieName, length=10, all=False):

	which returns the cast list of the requsted movie by passing Movie Name as a parameter

length: No of castlist which will be returned (default "10")

all: if set to True returns all the cast list (default "False")

getCastingByImdbId(IMDB_ID , length=10, all=False):

	which returns the cast list of the requsted movie by IMDB ID as a prameter

length: No of castlist which will be returned (default "10")

all: if set to True returns all the cast list (default "False")

getSummary(movieName ):

	which returns the summary of the requsted movie by passing Movie Name as a parameter

getSummaryByImdbId(IMDB_ID ):

	which returns the summary of the requsted movie by IMDB ID as a prameter

getMovie(movieName ):

	which returns the an object with data of the requsted movie by passing Movie Name as a parameter (see getMovieByImdbId() for more deatails)

getMovieByImdbId(IMDB_ID ):

	which returns the data of the requsted movie by IMDB ID as a prameter, data is as follows
	
	title - Movie full tile
	runTime - duration of the movie
	titleYear - year of the movie title
	releaseDate - date of the movie
	gener - gener as an array
	posterUrl - url of the movie poster
	rating - rating of the movie
	summary - summary text
	director - name of the director
	casting - list of top 10 cast (can be tweaked to print all the casting)

Example

from IMDBAPI import IMDB

imdb = IMDB()

print("Movie rated: "+imdb.getRating('darknight rises')+" out of 10")

Movie: The Dark Knight Rises
Movie rated:  '8.4' out of 10


Sample1.py output: (pretty printed just for viewing)

Enter a movie: darknight rises

Movie: The Dark Knight Rises
Movie Rated: 8.4 out Of 10

Movie: The Dark Knight Rises
Summary: Eight years after the Joker's reign of anarchy, Batman, with the help of the enigmatic Catwoman, is forced from his exile to save Gotham City, now on the edge of total annihilation, from the brutal guerrilla terrorist Bane.

Movie: The Dark Knight Rises
Director: ChristopherNolan

Movie: The Dark Knight Rises
Cast_list size: 10

{
	'actor': 'Christian Bale',
	'role': 'Bruce Wayne'
} {
	'actor': 'Gary Oldman',
	'role': 'Commissioner Gordon'
} {
	'actor': 'Tom Hardy',
	'role': 'Bane'
} {
	'actor': 'Joseph Gordon-Levitt',
	'role': 'Blake'
} {
	'actor': 'Anne Hathaway',
	'role': 'Selina'
} {
	'actor': 'Marion Cotillard',
	'role': 'Miranda'
} {
	'actor': 'Morgan Freeman',
	'role': 'Fox'
} {
	'actor': 'Michael Caine',
	'role': 'Alfred'
} {
	'actor': 'Matthew Modine',
	'role': 'Foley'
} {
	'actor': 'Alon Aboutboul',
	'role': 'Dr. Pavel       (as Alon Moni Aboutboul)'
}


Movie Details:
Movie: The Dark Knight Rises

{
	"title": "The Dark Knight Rises",
	
	"runTime": "2h44min",
	
	"titleYear": "2012",
	
	"releaseDate": "2012-07-20",
	
	"gener": ["Action", "Thriller"],
	
	"posterUrl": "https://m.media-amazon.com/images/M/MV5BMTk4ODQzNDY3Ml5BMl5BanBnXkFtZTcwODA0NTM4Nw@@._V1_UX182_CR0,0,182,268_AL__QL50.jpg",
	
	"rating ": "8.4 ",
	
	"summary ": "Eight years after the Joker 's reign of anarchy,Batman with the help of the enigmatic Catwoman,is forced from his exile to save Gotham City",
	
	"director ": "ChristopherNolan ", 
	
	"casting ": [{
		'actor': 'Christian Bale',
			'role': 'Bruce Wayne'
		}, {
			'actor': 'Gary Oldman',
			'role': 'Commissioner Gordon'
		}, {
			'actor': 'Tom Hardy',
			'role': 'Bane'
		}, {
			'actor': 'Joseph Gordon-Levitt',
			'role': 'Blake'
		}, {
			'actor': 'Anne Hathaway',
			'role': 'Selina'
		}, {
			'actor': 'Marion Cotillard',
			'role': 'Miranda'
		}, {
			'actor': 'Morgan Freeman',
			'role': 'Fox'
		}, {
			'actor': 'Michael Caine',
			'role': 'Alfred'
		}, {
			'actor': 'Matthew Modine',
			'role': 'Foley'
		}, {
			'actor': 'Alon Aboutboul',
			'role': 'Dr. Pavel       (as Alon Moni Aboutboul)'
		}
	]
}

IMDB_ID :

is an unique ID given by IMDB to a movie or series or a celebrity, IMDB_ID can be found in the URL.
if you open IMDB for a movie, say "The Dark night rises" the URL will be "https://www.imdb.com/title/tt1345836/"

this last text "tt1345836" is the IMDB ID of the movie

imdb_api_python's People

Contributors

devilking15292 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

vethavetha

imdb_api_python's Issues

Broken

Looks like imdb made some change that breaks it:

rating = imdb.getRating(name)

File "C:\python36\lib\site-packages\IMDBAPI_init_.py", line 32, in getRating
return IMDB.getRatingByImdbId(self, IMDB.getIdFromName(title))
File "C:\python36\lib\site-packages\IMDBAPI_init_.py", line 36, in getRatingByImdbId
return re.sub('\s+', '', IMDB.parseHTML(soup, 'div', 'class', 'ratingValue').strong.span.text)
AttributeError: 'NoneType' object has no attribute 'strong'

pip install error

with open('requirements.txt') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1

getRatingByImdbId() return error

return re.sub('\s+', '', IMDB.parseHTML(soup, 'div', 'class', 'ratingValue').strong.span.text)
AttributeError: 'NoneType' object has no attribute 'strong'

What's wrong?

Not Issue

Hi Hari,
Along with cast details, I want to download the actor images as well. Is it possible ?

Thanks,
Meena

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.