我正在尝试获取电影信息,特别是我有兴趣找到公司信息(即哪家公司制作了电影)。我在python中使用IMDBPY包但我找不到有关该公司的信息。我想知道是否有人能够从IMDB检索特定电影的公司信息。在API描述中,声明公司信息也可用,但我找不到它。只有我能看到这个信息,公司一无所知。 标题: 流派: 导向器: 作家: 运行: 国家: 语言: 评分: 情节: 标题: 封面网址:
答案 0 :(得分:2)
您应该发布您使用的代码片段。一个有效的代码示例:
>>> from imdb import IMDb
>>> ia = IMDb()
>>> dp = ia.get_movie('1431045')
>>> print dp.keys()
[u'music department', 'sound crew', 'camera and electrical department', u'distributors', 'rating', 'runtimes', 'costume designer', u'thanks', 'make up', 'year', 'production design', 'miscellaneous crew', 'color info', u'casting department', 'languages', 'votes', 'producer', 'title', 'mpaa', 'assistant director', 'writer', 'production manager', 'casting director', 'visual effects', 'top 250 rank', 'set decoration', 'editor', 'certificates', u'costume department', 'country codes', 'language codes', 'cover url', u'special effects department', 'special effects companies', 'sound mix', 'genres', u'production companies', 'stunt performer', 'miscellaneous companies', 'cinematographer', 'art direction', 'akas', 'aspect ratio', 'director', 'kind', u'art department', 'countries', u'transportation department', 'plot outline', 'plot', 'cast', u'animation department', 'original music', u'editorial department', 'canonical title', 'long imdb title', 'long imdb canonical title', 'smart canonical title', 'smart long imdb canonical title', 'full-size cover url']
>>> print dp.get('production companies')
[<Company id:0001946[http] name:_Donners' Company_>, <Company id:0475575[http] name:_Donners' Company, The_>, <Company id:0566686[http] name:_Kinberg Genre_>, <Company id:0047120[http] name:_Marvel Entertainment_>, <Company id:0420822[http] name:_TSG Entertainment_>, <Company id:0000756[http] name:_Twentieth Century Fox Film Corporation_>]
现在,您可能正在处理一个搜索查询结果的Movie对象。 如文档(http://imdbpy.sourceforge.net/support.html)中所述,结果对象仅包含有关电影的基本信息(在搜索结果中不存在所有其他信息后...)
要获取完整信息,您必须使用IMDb的类更新方法。例如:
>>> from imdb import IMDb
>>> ia = IMDb()
>>> s = ia.search_movie('Deadpool')
>>> dp = s[0]
>>> ia.update(dp)
>>> print dp.get('production companies')
[<Company id:0001946[http] name:_Donners' Company_>, <Company id:0475575[http] name:_Donners' Company, The_>, <Company id:0566686[http] name:_Kinberg Genre_>, <Company id:0047120[http] name:_Marvel Entertainment_>, <Company id:0420822[http] name:_TSG Entertainment_>, <Company id:0000756[http] name:_Twentieth Century Fox Film Corporation_>]