<jupyter_start><jupyter_text>Table of ContentsSection 1: Mars NewsSection 2: Mars ImageSection 3: Mars WeatherSection 4: Mars FactSection 5: Mars Heimsperes<jupyter_code>#Identify ChromeDriver Path

!which ChromeDriver
#Run Chrome Driver, you should now see the browser on your desktop.

executable_path = {'executable_path':'/usr/local/bin/ChromeDriver'}
browser = Browser('chrome', **executable_path, headless=False)<jupyter_output><empty_output><jupyter_text>Section 1: Mars News<jupyter_code>#Visit the Targeted URL in Chrome Driver

url = 'https://mars.nasa.gov/news/'
browser.visit(url)
mars_news_html=browser.html
mars_news_soup = BeautifulSoup(mars_news_html,'html.parser')
print(mars_news_soup.prettify())
#Find the Latest Title and Paragraph, and store them inside a variable

title_html = mars_news_soup.find('h3',class_=None)

for title in title_html:
    news_title = title
    

for paragraph in paragraphs:
    news_p = paragraph<jupyter_output><empty_output><jupyter_text>Section 2: Mars Image<jupyter_code>#visit our second site

url_2 = 'https://www.jpl.nasa.gov/spaceimages/?search=&category=Mars'
browser.visit(url_2)
jpl_html = browser.html
jpl_soup = BeautifulSoup(jpl_html,'html.parser')
print(jpl_soup.prettify())
#save featured image url

featured_image_url = 'https://www.jpl.nasa.gov' + jpl_soup.find('img',class_='thumb')['src']<jupyter_output><empty_output><jupyter_text>Section 3: Mars Weather<jupyter_code>#Visit Mars Weather Twitter Account and Retrieve HTML

mars_weather_twitter_url = 'https://twitter.com/marswxreport?lang=en'
browser.visit(mars_weather_twitter_url)

mars_weather_twitter_html = browser.html
mars_weather_soup = BeautifulSoup(mars_weather_twitter_html,'html.parser')
mars_weather = mars_weather_soup.find('p',class_='tweet-text').text<jupyter_output><empty_output><jupyter_text>Section 4: Mars Fact<jupyter_code>mars_facts_url = 'https://space-facts.com/mars/'
browser.visit(mars_fact_url)

mars_facts_html = browser.html
mars_facts_soup = BeautifulSoup(mars_facts_html,'html.parser')
first_column_data = mars_facts_soup.find_all('td',class_='column-1')
second_column_data = mars_facts_soup.find_all('td',class_='column-2')

labels = []
values = []

for x in first_column_data:
    labels.append(x.text)
    
for y in second_column_data:
    values.append(y.text)

    
mars_facts_df = pd.DataFrame({
    "Labels":labels,"Values":values
    
})

mars_facts_df<jupyter_output><empty_output><jupyter_text>Section 5: Mars Heimsperes<jupyter_code>#Retrieve the targeted Webpage HTML

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

mars_heimsperes_html = browser.html
mars_heimsperes_soup = BeautifulSoup(mars_heimsperes_html,'html.parser')
#Retrieve Title from Title HTML

title_html = mars_heimsperes_soup.find_all('h3')
titles=[]

for x in title_html:
    titles.append(x.text)
#Retrieve Image URL

img_url = []

for title in titles:
    browser.click_link_by_partial_text(title)
    time.sleep(2)
    mars_img_html=browser.html
    mars_img_soup= BeautifulSoup(mars_img_html,'html.parser')
    mars_img = mars_img_soup.find('a',text='Original')
    img_url.append(mars_img.get('href'))
    browser.back()
    time.sleep(2)
#Creating the Mars Dictionary

mars_hemisphere_image_urls = dict(zip(titles,img_url))
mars_hemisphere_image_urls
browser.quit()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11461067366579178, 'fraction_numerical': 0.0058326042578011085, 'mean_word_length': 7.166666666666667, 'pattern_counts': {'":': 2, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 6, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '387444', 'license': 'MIT', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1259, 'n_words': 204, 'path': 'mission_to_mars.ipynb', 'repo_name': 'ykpengba/Mars_Project', 'size': '3429'}