<jupyter_start><jupyter_text>NASA Mars<jupyter_code>url = 'https://mars.nasa.gov/news/'
browser.visit(url)
html = browser.html
soup = BeautifulSoup(html, "html.parser")
article = soup.find("div", class_='list_text')
news_title = article.find("div", class_="content_title").text
news_p = article.find("div", class_="article_teaser_body").text
print(news_title)
print(news_p)<jupyter_output>Mars InSight Lander Seen in First Images from Space 
Look closely, and you can make out the lander's solar panels.<jupyter_text>JPL Mars Space Images<jupyter_code>image_url = "https://www.jpl.nasa.gov/spaceimages/?search=&category=Mars"
browser.visit(image_url)
html = browser.html
soup = BeautifulSoup(html, "html.parser")

image = soup.find('a', class_= 'button fancybox')['data-fancybox-href']
feature_img = 'https://www.jpl.nasa.gov' + image
print(feature_img)<jupyter_output>https://www.jpl.nasa.gov/spaceimages/images/mediumsize/PIA18291_ip.jpg<jupyter_text>Mars Weather<jupyter_code>url = "https://twitter.com/marswxreport?lang=en"
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')

mars_weather = soup.find_all('p')[5].get_text()
print(mars_weather)<jupyter_output>Sol 2257 (2018-12-12), high -4C/24F, low -72C/-97F, pressure at 8.36 hPa, daylight 06:36-18:50<jupyter_text>Mars Facts<jupyter_code>import pandas as pd
url = 'http://space-facts.com/mars/'
marsfacts = pd.read_html(url)
#marsfacts

# Using .rename(columns={}) in order to rename columns
marsfacts_df = marsfacts[0]
renamed_marsfacts_df = marsfacts_df.rename(columns={0:"Facts", 1:"Value"})
#renamed_marsfacts_df

#mars_facts=mars_facts.set_index('description')
renamed_marsfacts_df1 = renamed_marsfacts_df.set_index('Facts')
renamed_marsfacts_df1

#Convert df to html table string
marsfacts_html=renamed_marsfacts_df.to_html()
#print(marsfacts_html)<jupyter_output><table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Facts</th>
      <th>Value</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>Equatorial Diameter:</td>
      <td>6,792 km</td>
    </tr>
    <tr>
      <th>1</th>
      <td>Polar Diameter:</td>
      <td>6,752 km</td>
    </tr>
    <tr>
      <th>2</th>
      <td>Mass:</td>
      <td>6.42 x 10^23 kg (10.7% Earth)</td>
    </tr>
    <tr>
      <th>3</th>
      <td>Moons:</td>
      <td>2 (Phobos &amp; Deimos)</td>
    </tr>
    <tr>
      <th>4</th>
      <td>Orbit Distance:</td>
      <td>227,943,824 km (1.52 AU)</td>
    </tr>
    <tr>
      <th>5</th>
      <td>Orbit Period:</td>
      <td>687 days (1.9 years)</td>
    </tr>
    <tr>
      <th>6</th>
      <td>Surface Temperature:</td>
      <td>-153 to 20 °C</td>
    </tr>
    <tr>
      <th>7</th>
      <td>First Record:</td>
      <td>2nd millennium BC</td>
    </tr>
    <tr>
      <th>8</th>
      <td[...]<jupyter_text>Mars Hemispheres<jupyter_code>hemispheres_url = "https://astrogeology.usgs.gov/search/results?q=hemisphere+enhanced&k1=target&v1=Mars"
browser.visit(hemispheres_url)
html = browser.html
soup = BeautifulSoup(html, "html.parser")
mars_hemisphere = []

products = soup.find("div", class_ = "collapsible results" )
hemispheres = products.find_all("div", class_="item")

for hemis in hemispheres:
    title = hemis.find("h3").text
    title = title.replace("Enhanced", "")
    link = hemis.find("a")["href"]
    img_link = "https://astrogeology.usgs.gov/" + link    
    browser.visit(img_link)
    html = browser.html
    soup=BeautifulSoup(html, "html.parser")
    downloads = soup.find("div", class_="downloads")
    image_url = downloads.find("a")["href"]
    mars_hemisphere.append({"title": title, "img_url": image_url})
mars_hemisphere<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17397113842864778, 'fraction_numerical': 0.025654730090860504, 'mean_word_length': 4.092517006802721, 'pattern_counts': {'":': 2, '<': 97, '<?xml version=': 0, '>': 96, 'https://': 7, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '638249', 'license': 'ADSL', 'n_tokens_mistral': 1574, 'n_tokens_neox': 1481, 'n_words': 241, 'path': 'mission_to_mars-checkpoint.ipynb', 'repo_name': 'Ratnakapoor/Web-Scrapping', 'size': '3742'}