HomeLanguagesPython IMDbPY – Getting IMDb index of person

Python IMDbPY – Getting IMDb index of person

In this article we will see how we can get the index of person from the imdb database, imdb have given people index to categorize them index is not numerical value it is roman number for example Salman Khan, SRK has got (I) as index also some people are not indexed. Below is the image to show how index of person looks like
 

 

In order to do this we have to do the following –
1. Get the person object with the help of id by using get_person_filmography method 
2. Get the index from it using result[‘data’][‘imdbIndex’] as keys 
3. Print the result 
 

Note : Output will be the link of the image i.e string data type not actual image
Below is the implementation 
 

Python3




# importing the module
import imdb
 
# creating instance of IMDb
ia = imdb.IMDb()
 
# person id
code = "1372788"
 
# getting person object
actor = ia.get_person_filmography(code)
 
# printing object name
print(actor['data']['name'])
 
# getting index
index = actor['data']['imdbIndex']
 
# printing
print(index)


Output : 
 

Shahid Kapoor
I

Another example 
 

Python3




# importing the module
import imdb
 
# creating instance of IMDb
ia = imdb.IMDb()
 
# person id
code = "0262635"
 
# getting person object
actor = ia.get_person_filmography(code)
 
# printing object name
print(actor['data']['name'])
 
# getting index
index = actor['data']['imdbIndex']
 
# printing
print(index)


Output : 
 

Chris Evans
V

 

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32688 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7057 POSTS0 COMMENTS
Nicole Veronica
12198 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12293 POSTS0 COMMENTS
Shaida Kate Naidoo
7182 POSTS0 COMMENTS
Ted Musemwa
7447 POSTS0 COMMENTS
Thapelo Manthata
7160 POSTS0 COMMENTS
Umr Jansen
7150 POSTS0 COMMENTS