<jupyter_start><jupyter_text>NASA MARS NEWS Scrape the NASA Mars News Site and collect the latest News Title and Paragraph Text. Assign the text to variables that you can reference later.<jupyter_code>executable_path = {'executable_path': '/usr/local/bin/chromedriver'}
browser = Browser('chrome', **executable_path, headless=False)

# URL of page to be scraped
url ='https://mars.nasa.gov/news'
browser.visit(url)
html = browser.html

# Retrieve page with the requests module
response = requests.get(url)

# Parse HTML with Beautiful Soup
soup = BeautifulSoup(html, "html.parser")
# Extract article title and paragraph text
slide= soup.select_one('ul.item_list li.slide')
#article = slide.find("div", class_='list_text')
news_title = slide.find("div", class_="content_title").text.strip()
news_p = slide.find("div", class_ ="article_teaser_body").text

print(news_title)
print(news_p)
#print(slide)
#print(article)<jupyter_output><empty_output><jupyter_text>JPL Mars Space Images - Featured Image<jupyter_code>executable_path = {'executable_path': '/usr/local/bin/chromedriver'}
browser = Browser('chrome', **executable_path, headless=False)

# Visit url for JPL Featured Space Image
image_url = "https://www.jpl.nasa.gov/spaceimages/?search=&category=Mars"
browser.visit(image_url)
feat_image=browser.find_by_id('full_image').click()
browser.is_element_present_by_text('more info', wait_time=2)

browser.click_link_by_partial_text('more info')
html2 = browser.html
# Retrieve page with the requests module
response = requests.get(image_url)
# Parse HTML with Beautiful Soup
image_soup = BeautifulSoup(html2, "html.parser")
#print(image_soup)
# Scrape the URL
featured_image= image_soup.find('figure', class_= 'lede').a['href']
link = f'https://www.jpl.nasa.gov{featured_image}'
print(link)<jupyter_output><empty_output><jupyter_text>Mars WeatherVisit the Mars Weather twitter account here and scrape the latest Mars weather tweet from the page. Save the tweet text for the weather report as a variable called mars_weather.Note: Be sure you are not signed in to twitter, or scraping may become more difficult.Note: Twitter frequently changes how information is presented on their website. If you are having difficulty getting the correct html tag data, consider researching Regular Expression Patterns and how they can be used in combination with the .find() method.<jupyter_code>executable_path = {'executable_path': '/usr/local/bin/chromedriver'}
browser = Browser('chrome', **executable_path, headless=False)

Twitter_url = "https://twitter.com/marswxreport?lang=en"
browser.visit(Twitter_url)
html3 = browser.html
time.sleep(5)

# Parse HTML with Beautiful Soup
Twt_soup = BeautifulSoup(html3, 'html.parser')

# Extract latest tweet
weather_tweet= Twt_soup.findAll("span", class_= "css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0")
weather_tweet()<jupyter_output><empty_output><jupyter_text>Am not able to complete due to chrome and mac incapatabilies     Mars FactsVisit the Mars Facts webpage here and use Pandas to scrape the table containing facts about the planet including Diameter, Mass, etc.Use Pandas to convert the data to a HTML table string.<jupyter_code>executable_path = {'executable_path': '/usr/local/bin/chromedriver'}
browser = Browser('chrome', **executable_path, headless=False)

# Visit Mars facts url 
facts_url = 'http://space-facts.com/mars/'
html_facts = pd.read_html(facts_url)

# Find the mars facts DataFrame and assign columns
mars_df = html_facts[0]
mars_df.columns = ['Description','Value']

# Save html code 
mars_df.to_html()

mars_df<jupyter_output><empty_output><jupyter_text>Mars HemispheresVisit the USGS Astrogeology site here to obtain high resolution images for each of Mar's hemispheres.You will need to click each of the links to the hemispheres in order to find the image url to the full resolution image.Save both the image url string for the full resolution hemisphere image, and the Hemisphere title containing the hemisphere name. Use a Python dictionary to store the data using the keys img_url and title.Append the dictionary with the image url string and the hemisphere title to a list. This list will contain one dictionary for each hemisphere.<jupyter_code>executable_path = {"executable_path": "/usr/local/bin/chromedriver"}
browser = Browser("chrome", **executable_path, headless=False)

# Visit the USGS Astrogeology Science Center Site

url = "https://astrogeology.usgs.gov/search/results?q=hemisphere+enhanced&k1=target&v1=Mars"
browser.visit(url)

hemi_img_urls = []

# Get a List of All the Hemispheres
links = browser.find_by_css("a.product-item h3")
for item in range(len(links)):
    hemisphere = {}
    
    browser.find_by_css("a.product-item h3")[item].click()
    
    # Find Sample Image Anchor Tag & Extract <href>
    sample = browser.find_link_by_text("Sample").first
    hemisphere["img_url"] = sample["href"]
    
    # Get Hemisphere Title
    hemisphere["title"] = browser.find_by_css("h2.title").text
    
    # Append List
    hemi_img_urls.append(hemisphere)
    
    # Navigate Backwards
    browser.back()
    

hemi_img_urls<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10095127159774801, 'fraction_numerical': 0.0048534265191225, 'mean_word_length': 5.778947368421052, 'pattern_counts': {'":': 1, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 5, 'lorem ipsum': 0, 'www.': 2, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '158509', 'license': 'ADSL', 'n_tokens_mistral': 1674, 'n_tokens_neox': 1604, 'n_words': 482, 'path': 'mission_to_mars.ipynb', 'repo_name': 'EMDeLeon/web-scraping-challenge', 'size': '5151'}