sna*_*ack 5 python imdb imdbpy
我正在尝试创建一个数据集,允许我根据来自 Python IMDb API 的演员 ID 和电影 ID 加入演员和电影。现在,我正试图从演员的片目中提取电影 ID 列表,但无法做到。
例如,我知道 IMDb 上 Rodney Dangerfield 的 ID 是 0001098。我可以通过以下方式查看他的整个片目:
from imdb import IMDb
ia = IMDb()
actor_results = ia.get_person_filmography('0001098')
Run Code Online (Sandbox Code Playgroud)
它返回一个大字典。我可以看到他获得表演功劳的最新电影:
actor_results['data']['filmography'][0]['actor'][0]
Run Code Online (Sandbox Code Playgroud)
返回:
<Movie id:0179803[http] title:_Angels with Angles (2005)_>
Run Code Online (Sandbox Code Playgroud)
此对象类型是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)')]
Run Code Online (Sandbox Code Playgroud)
但是没有身份证钥匙。当我尝试使用 将 IMDb 对象转换为字符串时str(results['data']['filmography'][0]['actor'][0]),我只得到'Angels with Angels'.
有没有办法从 IMDb 对象中获取电影 ID?
| 归档时间: |
|
| 查看次数: |
1312 次 |
| 最近记录: |