Python IMDbPY – Searching keyword
In this article we will 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 moduleimport imdb # creating instance of IMDbia = imdb.IMDb() # keywordkeyword = "Delhi" # searching keywordsearch = 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 moduleimport imdb # creating instance of IMDbia = imdb.IMDb() # keywordkeyword = "avengers tower" # searching keywordsearch = ia.search_keyword(keyword)# printing the search print(search) |
Output :
['avengers-tower']
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course


