无法检索带有“aka”的电影的情节大纲

2024-05-16 13:46:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要提取一些电影的imdb“情节大纲”(故事情节)。对他们中的大多数人来说,我是通过以下方式得到的:

description = movie.get('plot outline')

但是,对于某些电影,它返回一个空字符串(尽管当我在IMDb网站上手动查看它时有一个故事情节)。 大多数电影都有不同的片名,原片名和“aka”(但不是全部) 例如: http://www.imdb.com/title/tt0185584/?ref_=fn_al_tt_1

我尝试使用

pprint (vars(m))

它不包含“情节大纲”。你知道吗

其他人都有这个问题并且知道如何解决吗?你知道吗


Tags: 字符串get电影plot网站方式description手动
1条回答
网友
1楼 · 发布于 2024-05-16 13:46:57

代码中存在各种问题和一些bug。你知道吗

首先,请记住,搜索结果不会包含任何有关电影的详细信息:您需要更新存储在电影实例中的信息。你知道吗

另一个事实是,IMDb已经改变了它显示绘图大纲和概要的方式,现在也包括在绘图页中。你知道吗

最后要注意的是,代码中有一个小bug,在检索概要时,您还将得到一个警告,该警告肯定不存在。你知道吗

代码示例:

#!/usr/bin/env python                                                           
# -*- coding: utf-8 -*-                                                          

from imdb import IMDb                                                            

ia = IMDb()                                                                      

# Search for  movie; the results will just have a title and little more         
# information.                                                                  
results = ia.search_movie('Osobennosti natsionalnoy rybalki')                    
onr = results[0]                                                                 
print 'Plot from search results: %s' % onr.get('plot outline')                   
print 'Synopsis from search results: %s' % onr.get('synopsis')                   

# Update the default information (main page and plot)                           
ia.update(onr)                                                                   
print 'Plot after the update: %s' % onr.get('plot outline')                      

# Update a specific sub-page                                                    
ia.update(onr, 'synopsis')                                                       
print 'Synopsis after the update: %s' % onr.get('synopsis')

其输出:

Plot from search results: None Synopsis from search results: None Plot after the update:  Synopsis after the update: This synopsis is too short and may not include the required detailed description of the entire plot. We normally require that synopses be at least 10 lines long. If you have seen this title, please help us by improving and expanding this synopsis.








General Ivolgin, forester Kuzmich, and good-natured Lyova lose their way on a fishing trip and wind up in a neighboring country, where they decide to have a good time anyway but end up leaving their vodka and fishing equipment behind.

当然,应该直接从plotoutline页面解析概要(如果缺少plotoutline,甚至可以使用它来代替它)。 请在https://github.com/alberanid/imdbpy/issues中打开错误报告

相关问题 更多 >