我正在尝试获取特定类型的电影名称并运行我的下面的函数,然后我才得到英文电影的名称现在它应该像这样“黑暗骑士”而不是“黑暗骑士”应该给出下面的函数工作正常,在他们给我确切的英文版本名称之前!我真的很惊讶也很沮丧
Action_soup = site_soup('https://www.imdb.com/search/title/?.....')
Action_soup.find_all(class_ = 'lister-item-header')
def site_soup(link):
r = requests.get(str(link), auth=("user",'pass'))
soup = bs(r.content)
return soup
#create the function for specific genres movies list
def movies_list(st,Soup):
movies = Soup.find_all(class_ = str(st))
movie_list = []
for i in movies:
movie_list.append(i.find('a').string)
return movie_list
前一天的输出:
Action_movies[0]
:'The Dark Knight'
输出:
<h3 class="lister-item-header">
<span class="lister-item-index unbold text-primary">1.</span>
<a href="/title/tt0468569/">黑暗騎士</a>
<span class="lister-item-year text-muted unbold">(2008)</span>
</h3>, <h3 class="lister-item-header">