pythonimdbpy

How to retrieve IMDB movie ID from imdbpy?


The Python imdbpy module allows you search by movie title.

Example:


import imdb


ia = imdb.IMDb()

search_movie = ia.search_movie('Ready Player One')

Result:


[<Movie id:1677720[http] title:_Ready Player One (2018)_>, <Movie id:8183756[http] title:_"Projector" Ready Player One (2018)_>, <Movie id:13695838[http] title:_"Big Pauly Talks Movies" Ready Player One (2018)_>, <Movie id:8045574[http] title:_"Ready Player One LIVE at SXSW" (2018)_>, ...]

How do grab the first Movie id from the results?

Tried:


Solution

  • A quick check of the source code shows that you want print(search_movie[0]['movieID']) or print(search_movie[0].getID().