def parse_html(html): soup = BeautifulSoup(html, 'lxml') movie_list_soup = soup.find('ol', attrs = {'class': 'grid_view'}) movie_name_list = []
for movie_li in movie_list_soup.find_all('li'):
detail = movie_li.find('div', attrs = {'class': 'hd'})
movie_name = detail.find('span', attrs = {'class': 'title'}).getText()
movie_name_list.append(movie_name)
print(movie_name_list)
next_page = soup.find('span', attrs = {'class': 'next'}).find('a')
if next_page:
return movie_name_list, DOWNLOAD_URL + next_page['href']
return movie_name_list, None