def _compare_external_links(page_source, movie, external_url_base, site_name): movie_details_page = BeautifulSoup(page_source, 'html.parser') external_links = movie_details_page.find(id='info-wrapper').find('ul', class_='external').find_all('a') for link in external_links: if external_url_base in link['href']: if site_name == 'imdb': return IMDB.normalize_imdb_id(movie['imdb']['id']) == \ IMDB.normalize_imdb_id(link['href'].split('/')[-1]) return movie[site_name]['id'] == link['href'].split('/')[-1] return False
def _compare_external_links(page_source, movie, external_url_base, site_name): movie_details_page = BeautifulSoup(page_source, 'html.parser') if movie_details_page.find(class_='ratingstable'): external_links = movie_details_page.find( class_='ratingstable').find_all('a') for link in external_links: if external_url_base in link['href']: link_href = link['href'].strip('/') return IMDB.normalize_imdb_id(movie[site_name]['id']) == \ IMDB.normalize_imdb_id(link_href.split('/')[-1]) return False
def _compare_external_links(page_source, movie, external_url_base, site_name): movie_details_page = BeautifulSoup(page_source, 'html.parser') try: external_links = movie_details_page.find( id='fi_info_ext').find_all('a') except AttributeError: return False for link in external_links: if external_url_base in link['href']: return IMDB.normalize_imdb_id(movie[site_name]['id']) == \ IMDB.normalize_imdb_id(link['href'].rstrip('/').split('/')[-1]) return False
def _compare_external_links(page_source, movie, external_url_base, site_name): movie_details_page = BeautifulSoup(page_source, "html.parser") external_links = (movie_details_page.find(id="info-wrapper").find( "ul", class_="external").find_all("a")) for link in external_links: if external_url_base in link["href"]: if site_name == "imdb": return IMDB.normalize_imdb_id( movie["imdb"]["id"]) == IMDB.normalize_imdb_id( link["href"].split("/")[-1]) return movie[site_name]["id"] == link["href"].split("/")[-1] return False