使用 IMDBPY 从 IMDB 获取电影的公司信息

get the company info for a movie from IMDB using IMDBPY

我正在尝试获取电影信息,特别是我有兴趣查找公司信息(即哪家公司制作了这部电影)。我在 python 中使用 IMDBPY 包,但我找不到有关该公司的信息。我想知道是否有人能够从 IMDB 检索特定电影的公司信息。在API 描述中,说公司信息也可用,但我找不到。只有我能看到这个信息,没有关于公司的任何信息。 标题: 类型: 导演: 作家: 运行: 国家: 语言: 评分: 阴谋: 标题: 封面url:

您应该 post 您使用的代码片段。一个工作代码示例:

>>> 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 的 class 更新方法。例如:

>>> 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_>]