示例#1
0
def get_related_actors(soup):
    related_actors = {}
    links = soup.find_all('a')
    for link in links:
        if link_after_all_actors(link, soup):
            break
        if not link_has_good_href(link):
            continue
        actor_slug = get_actor_slug(link)
        actor_url  = string_functions.to_wiki_url(actor_slug)
        if actor_url in related_actors.values():
            continue
        try:
            actor_soup = soup_operations_functions.get_html_soup(actor_url)
        except HTTPError:
            continue
        if soup_info_functions.is_an_actor(actor_soup):
            actor_name = soup_info_functions.get_person(actor_soup)
            if actor_name == soup_info_functions.get_person(soup):
                continue
            related_actors[actor_name] = actor_url
            print(actor_name)
    return related_actors
def print_roles(soup):
    name = soup_info_functions.get_person(soup)
    print('Actor: ' + str(soup_info_functions.is_an_actor(soup)))
    print('Director: ' + str(soup_info_functions.is_a_director(soup)))
    print('Composer: ' + str(soup_info_functions.is_a_composer(soup)))
def print_roles(soup):
    name = soup_info_functions.get_person(soup)
    print('Actor: ' + str(soup_info_functions.is_an_actor(soup)))
    print('Director: ' + str(soup_info_functions.is_a_director(soup)))
    print('Composer: ' + str(soup_info_functions.is_a_composer(soup)))