import requests
from bs4 import BeautifulSoup


def img_getter(titles, url_list):
    """This function scrapes the urls passed in url_list and fetches title and img_url, puts it into dictionary and returns list of dinctionaries"""
    
    hemisphere_data = []
    hemisphere={}
    for i in range(len(titles)):
        response = requests.get(url_list[i])
        hemisphere_soup = BeautifulSoup(response.content, 'html.parser')
        
        for download in hemisphere_soup.find_all('div', {'class':'downloads'}):
            hemisphere['title'] = titles[i]
            hemisphere['img_url'] = download.ul.li.a['href']
        
        hemisphere_data.append(dict(hemisphere))
        
    return hemisphere_data