问题
I cannot find a way to get detailed data about movies released in 2018, while all works fine for older movies. I use default 'http' access (as described here: https://imdbpy.sourceforge.io/docs/README.package.txt)
How to get access to updated data???
Let's say i want to see details about Aquaman which is released winter 2018:
>>> aq = ia.search_movie('Aquaman')
>>> aq = aq[0]
>>> print(aq.keys())
['title', 'kind', 'year', 'canonical title', 'long imdb title', 'long imdb canonical title', 'smart canonical title', 'smart long imdb canonical title']
However all works fine for Deadpool, which is quite old movie! (I use this example to test: get the company info for a movie from IMDB using IMDBPY, so it's ok for records before 2018)
print(dp.keys())
['title', 'kind', 'year', 'cast', 'genres', 'runtimes', 'countries', 'country codes', 'language codes', 'color info', 'aspect ratio', 'sound mix', 'certificates', 'original air date', 'rating', 'votes', 'cover url', 'plot outline', 'languages', 'directors', 'writers', 'producers', 'composers', 'cinematographers', 'editors', 'editorial department', 'casting directors', 'production designers', 'art directors', 'set decorators', 'costume designers', 'make up department', 'production managers', 'assistant directors', 'art department', 'sound department', 'special effects', 'visual effects', 'stunts', 'camera department', 'animation department', 'casting department', 'costume departmen', 'location management', 'music department', 'transportation department', 'miscellaneous', 'thanks', 'akas', 'writer', 'director', 'production companies', 'distributors', 'special effects companies', 'other companies', 'plot', 'synopsis', 'canonical title', 'long imdb title', 'long imdb canonical title', 'smart canonical title', 'smart long imdb canonical title', 'full-size cover url']
So, i hope to be able to fetch company's data for Aquaman the same way as it's done for the Deadpool, because this data is already on the imdb web page.
回答1:
Since search_movie()
returns a list of movie objects who have 'year' as one of their parameters, you could search for the string you want, then filter out by year.
>>> deadpool_matches = ia.search_movie('Deadpool')
>>> deadpool_movies_2018 = [ m for m in deadpool_matches if m['year'] == '2018' ]
>>> likely_best_match = deadpool_movies_2018[0]
EDIT: Since you referred to Deadpool as "quite [an] old movie!", it sounded like you were referring to the 1988 Dirty Harry movie and trying to eliminate titles like that or the 2016 "Deadpool" movie (hardly "an old movie") in order to get the 2018 sequel. I see now that when trying to extract info on movies from 2018, you're saying the info simply doesn't come back even though it works for movies before 2018.
Does update(aq[0])
populate it?
来源:https://stackoverflow.com/questions/53875834/getting-recent-movie-data-from-imdb-using-imdbpy