<jupyter_start><jupyter_text>Visit The NASA Mars Newsite<jupyter_code># Visit the mars nasa news site
url = 'https://mars.nasa.gov/news/'
browser.visit(url)

# Optional delay for loading the page
browser.is_element_present_by_css("ul.item_list li.slide", wait_time=1)
# Convert the browser html to a soup object and then quit the browser
html = browser.html
news_soup = soup(html, 'html.parser')

slide_elem = news_soup.select_one('ul.item_list li.slide')
slide_elem.find("div", class_='content_title')
# Use the parent element to find the first `a` tag and save it as `news_title`
news_title = slide_elem.find("div", class_='content_title').get_text()
news_title
# Use the parent element to find the paragraph text
news_p = slide_elem.find('div', class_="article_teaser_body").get_text()
news_p<jupyter_output><empty_output><jupyter_text>JPL Featured Images<jupyter_code># Visit URL
url = 'https://data-class-jpl-space.s3.amazonaws.com/JPL_Space/index.html'
browser.visit(url)
# Find and click the full image button
full_image_elem = browser.find_by_tag('button')[1]
full_image_elem.click()
# Parse the resulting html with soup
html = browser.html
img_soup = soup(html, 'html.parser')
# Find the relative image url
img_url_rel = img_soup.find('img', class_='fancybox-image').get('src')
img_url_rel
# Use the base URL to create an absolute URL
img_url = f'https://data-class-jpl-space.s3.amazonaws.com/JPL_Space/{img_url_rel}'
img_url<jupyter_output><empty_output><jupyter_text>Mars Facts<jupyter_code>df = pd.read_html('http://space-facts.com/mars/')[0]

df.head()
df.columns=['Description', 'Mars']
df.set_index('Description', inplace=True)
df
df.to_html()<jupyter_output><empty_output><jupyter_text>Mars Weather<jupyter_code># Visit the weather website
url = 'https://mars.nasa.gov/insight/weather/'
browser.visit(url)
# Parse the data
html = browser.html
weather_soup = soup(html, 'html.parser')
# Scrape the Daily Weather Report table
weather_table = weather_soup.find('table', class_='mb_table')
print(weather_table.prettify())<jupyter_output><table class="mb_table" id="weather_observation">
 <thead>
  <tr>
   <th colspan="2" id="time_lbl" scope="col">
    Time
   </th>
   <th colspan="3" id="temperature_lbl" scope="col">
    Air Temperature (
    <span class="lbl_fahrenheit">
     °F
    </span>
    <span class="slash">
     |
    </span>
    <span class="lbl_celsius fadeBlack">
     °C
    </span>
    )
   </th>
   <th colspan="4" id="windspeed_lbl" scope="col">
    Wind Speed (
    <span class="lbl_mph">
     mph
    </span>
    <span class="slash">
     |
    </span>
    <span class="lbl_mps fadeBlack">
     m/s
    </span>
    )
   </th>
   <th colspan="3" id="pressure_lbl" scope="col">
    Pressure (Pa)
   </th>
  </tr>
 </thead>
 <tbody>
  <tr id="weather_top">
   <th class="sol" scope="row">
    Date
   </th>
   <th class="sol" scope="row">
    Sol
   </th>
   <td class="temperature max">
    Max.
   </td>
   <td class="temperature avg">
    Avg.
   </td>
   <td class="temperature min">
    Min.
   </td>
   <td clas[...]<jupyter_text>Scrape High-Resolution Mars’ Hemisphere Images and Titles  Hemispheres<jupyter_code># 1. Use browser to visit the URL 
url = 'https://astrogeology.usgs.gov/search/results?q=hemisphere+enhanced&k1=target&v1=Mars'
browser.visit(url)
time.sleep(1)
# 2. Create a list to hold the images and titles.
html = browser.html
soups = soup(html, "lxml")

img_divs = soups.find_all("div", class_ = "description")


hemisphere_image_urls = []

# 3. Write code to retrieve the image urls and titles for each hemisphere.
base_url = "https://astrogeology.usgs.gov"
for img_div in img_divs:
    img_info = {}
    img_title = img_div.find("h3").text
    img_info["title"] = img_title
    partial_img_url = img_div.find("a", class_ = "itemLink product-item")["href"]
    full_img_url = base_url + partial_img_url
    browser.visit(full_img_url)
    full_img_url = browser.html
    soups = soup(full_img_url, "lxml")
    img_url = soups.find("div", class_ = "downloads").li.a["href"]    
    img_info["img_url"]=img_url
    hemisphere_image_urls.append(img_info)
# 4. Print the list that holds the dictionary of each image url and title.
hemisphere_image_urls
# 5. Quit the browser
browser.quit()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1425228176924877, 'fraction_numerical': 0.004212497074654809, 'mean_word_length': 4.458492975734355, 'pattern_counts': {'":': 0, '<': 58, '<?xml version=': 0, '>': 57, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '184456', 'license': 'MIT', 'n_tokens_mistral': 1594, 'n_tokens_neox': 1566, 'n_words': 351, 'path': 'Mission_to_Mars.ipynb', 'repo_name': 'Solrys/Mission_To_Mars', 'size': '4273'}