<jupyter_start><jupyter_text>NASA Mars News---<jupyter_code>#Setup splinter
executable_path = {'executable_path':  '/usr/local/bin/chromedriver'}
browser = Browser('chrome', **executable_path, headless=False)
url = 'https://redplanetscience.com/'
browser.visit(url)
html = browser.html
soup = BeautifulSoup(html, 'html.parser')
# Scrape the Mars News Site and collect the latest News Title and Paragraph Text. 
#Assign the text to variables that you can reference later.
news_title = soup.find('div', class_='content_title')
news_p = soup.find('div', class_='article_teaser_body')
    
print(news_title.text)
print(news_p.text)
browser.quit()<jupyter_output><empty_output><jupyter_text>JPL Mars Space Images - Featured Image---<jupyter_code>executable_path = {'executable_path': ChromeDriverManager().install()}
browser = Browser('chrome', **executable_path, headless=False)
url = 'https://spaceimages-mars.com'
browser.visit(url)
html = browser.html
soup = BeautifulSoup(html, 'html.parser')

div = soup.find('div', class_="floating_text_area")

link = div.find('a')
href = link['href']

featured_image_url= f"{url}/{href}"
print(featured_image_url)
browser.quit()<jupyter_output><empty_output><jupyter_text>Mars Facts---<jupyter_code>executable_path = {'executable_path': ChromeDriverManager().install()}
browser = Browser('chrome', **executable_path, headless=False)
url = 'https://galaxyfacts-mars.com/'
browser.visit(url)
html = browser.html
soup = BeautifulSoup(html, 'html.parser')
tables = pd.read_html(url)
tables
mars_facts_df= tables[1]
mars_facts_df.columns = ['Category', 'Mars Value']
mars_facts_df
html_table = mars_facts_df.to_html()
html_table
html_table_string=html_table.replace('\n', '')
html_table_string
browser.quit()<jupyter_output><empty_output><jupyter_text>Mars Hemispheres---<jupyter_code>executable_path = {'executable_path': ChromeDriverManager().install()}
browser = Browser('chrome', **executable_path, headless=False)
hemispheres_url = 'https://marshemispheres.com/'
browser.visit(hemispheres_url)
hemispheres_html = browser.html
hemispheres_soup = BeautifulSoup(html, 'html.parser')
# Mars hemispheres 
images = hemispheres_soup.find_all('div', class_='item')
hemisphere_title = []
hemisphere_img_url = []
for x in images:
    hemisphere_title = x.find('h3').text
    #print(hemisphere_title)
    url1 = x.find('a', class_= 'itemLink product-item')['href']
    #print(url1)
    url2 = hemispheres_url + url1
    #print(url2)
    
    browser.visit(url2)
    html = browser.html
    soup = BeautifulSoup(html,'html.parser')
    # navigate to individual images
    src = soup.find('img', class_='wide-image').get('src')
    #print(src)
    img_url = hemispheres_url + src 
    #print(img_url)
    dictionary={"hemisphere_title": hemisphere_title,"img_url":img_url}
    hemisphere_img_url.append(dictionary) 
hemisphere_img_url
browser.quit()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14398897692042714, 'fraction_numerical': 0.002755769893213917, 'mean_word_length': 6.602094240837697, 'pattern_counts': {'":': 2, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '411264', 'license': 'ADSL', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1011, 'n_words': 174, 'path': 'Missions_to_Mars/mission_to_mars.ipynb', 'repo_name': 'melorebecca/web-scraping-challenge', 'size': '2903'}