def extract_links(bs4):
    """Extracting links from BeautifulSoup object

    :param bs4: `BeautifulSoup`
    :return: `list` List of links
    """

    unique_links = list(set([anchor['href'] for anchor in bs4.select('a[href]') if anchor.has_attr('href')]))

    # remove irrelevant link
    unique_links = [link for link in unique_links if link != '#']

    # convert invalid link with adding 'http' schema
    return [convert_invalid_url(link) for link in unique_links]
def extract_links ( bs4 ) : unique_links = list ( set ( [ anchor [ 'href' ] for anchor in bs4 . select ( 'a[href]' ) if anchor . has_attr ( 'href' ) ] ) ) unique_links = [ link for link in unique_links if link != '#' ] return [ convert_invalid_url ( link ) for link in unique_links ]
Extracting links from BeautifulSoup object

    :param bs4: `BeautifulSoup`
    :return: `list` List of links