Open In App

Python IMDbPY – Searching keyword

Last Updated : 26 Aug, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

In this article we will see how we can search a keyword in the IMDb database.
Keyword : It is a word (or group of connected words) attached to a title (movie / TV series / TV episode) to describe any notable object, concept, style or action that takes place during a title. The main purpose of keywords is to allow visitors to easily search and discover titles.

In order to search a key word we will use search_keyword method. 

Syntax : imdb_object.search_keyword(keyword)
Argument : It takes string as argument which is keyword
Return : It returns list. 
 

Below is the implementation.  

Python3




# importing the module
import imdb
  
# creating instance of IMDb
ia = imdb.IMDb()
  
# keyword
keyword = "Delhi"
  
# searching keyword
search = ia.search_keyword(keyword)
 
# printing the search 
print(search)


Output : 

['delhi', 'delhi-india', 'delhi-university', 'delhi-police', 'delhi-metro', 'delhi-gang-rape', 'new-delhi', 'old-delhi', 'flight-to-delhi', 'new-delhi-india', 'golden-temple-new-delhi', 'reference-to-new-delhi', 'india-gate-new-delhi', 'qutub-minar-delhi', 'chapel-hill', 'drexel-hill', 'institute-for-international-studies-new-delhi', 'model-home', 'model-hobby', 'model-heart', 'model-husband', 'scale-model-house', 'stadelheim-prison', 'reference-to-miguel-hidalgo', 'model-24-stielhandgranate', 'drug-cartel-hid-the-records-in-the-back-of-a-painting', 'university-of-north-carolina-at-chapel-hill', 'reference-to-michael-hinky-dink-kenna', "bazar-de-l'hotel-de-ville-paris", "reference-to-le-musee-de-l'homme-paris"]

Python3




# importing the module
import imdb
  
# creating instance of IMDb
ia = imdb.IMDb()
  
# keyword
keyword = "avengers tower"
  
# searching keyword
search = ia.search_keyword(keyword)
 
# printing the search 
print(search)


Output : 

['avengers-tower']

 



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads