from bs4 import BeautifulSoup


def extract_data_from_html(html, data):
    """
    Uses the Beautiful Soup library to extract all links (href) and 
    images (src) on a given page and stores the results in the 
    dictionary (dict). The dictionary with collected data is returned
    from the task.

    Args:
        html: String with HTML that will be parsed.
        data: dict object that will be complemented by extracted data.

    Returns:
        dict: Dictioanary containing extracted information.
    """
    soup = BeautifulSoup(html, 'html.parser')

    data['links'] = [] 
    data['images'] = []

    for link in soup.find_all('a'):
        data['links'].append(link.get('href'))

    for img in soup.find_all('img'):
        data['images'].append(img.get('src'))

    print('Links and images extracted.')
    return data