从 IMDbPy 结果中的电影中获取电影 ID



我正在尝试创建一个数据集,允许我根据Python IMDb API中的演员ID和电影ID加入演员和电影。现在,我正在尝试从演员的电影中提取电影ID列表,但无法做到。

例如,我知道IMDb上罗德尼·丹格菲尔德的ID是0001098。我可以看到他的整个电影作品:

from imdb import IMDb
ia = IMDb()
actor_results = ia.get_person_filmography('0001098')

返回一个大字典。我可以看到他最近的一部电影,其中有表演功劳:

actor_results['data']['filmography'][0]['actor'][0]

返回:

<Movie id:0179803[http] title:_Angels with Angles (2005)_>

此对象类型为 imdb.Movie.Movie 。此对象有几个键/值对:

In: results['data']['filmography'][0]['actor'][0].items()
Out: 
[('title', 'Angels with Angles'),
 ('kind', 'movie'),
 ('year', 2005),
 ('canonical title', 'Angels with Angles'),
 ('long imdb title', 'Angels with Angles (2005)'),
 ('long imdb canonical title', 'Angels with Angles (2005)'),
 ('smart canonical title', 'Angels with Angles'),
 ('smart long imdb canonical title', 'Angels with Angles (2005)')]

但是没有ID密钥。当我尝试将IMDb对象转换为带有str(results['data']['filmography'][0]['actor'][0])的字符串时,我只是得到'Angels with Angels'.

有没有办法从 IMDb 对象获取电影 ID?

results['data']['filmography'][0]['actor'][0].getID()

最新更新