<jupyter_start><jupyter_text>JPL Mars Space Images - Featured Image<jupyter_code>executable_path = {'executable_path': '/Users/Ben/chromedriver'}
browser = Browser('chrome', **executable_path, headless=False)

url_JPL = "https://www.jpl.nasa.gov/spaceimages/?search=&category=Mars"
browser.visit(url_JPL)
# Use splinter to navigate the site and find the image url for the current Featured Mars Image and assign the url string to a variable called featured_image_url.
browser.find_by_id("full_image").click()
browser.is_element_present_by_text("more info", wait_time=1)
browser.find_link_by_partial_text("more info").click()
html = browser.html
soup = bs(html, "html.parser")
img = soup.select_one("img.main_image").get("src")
featured_image_url = 'https://jpl.nasa.gov'+img
img<jupyter_output><empty_output><jupyter_text>Mars Weather<jupyter_code>executable_path = {'executable_path': '/Users/Ben/chromedriver'}
browser = Browser('chrome', **executable_path, headless=False)

url_twitter = "https://twitter.com/marswxreport?lang=en"
browser.visit(url_twitter)
# parse the html
html = browser.html
soup = bs(html, "html.parser")
soup
# Visit the Mars Weather twitter account and scrap the lates Mars weather tweet.
import tweepy
# Twitter API Keys
from config import consumer_key, consumer_secret, access_token, access_token_secret

# Setup Tweepy API Authentication
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth, parser=tweepy.parsers.JSONParser())
target_user = "marswxreport"
full_tweet = api.user_timeline(target_user , count = 1)
mars_weather=full_tweet[0]['text']
mars_weather
latest_tweet = soup.find("div", class_="js-tweet-text-container").text
latest_tweet<jupyter_output><empty_output><jupyter_text>Mars Facts<jupyter_code>import pandas as pd
url_mars_facts = "https://space-facts.com/mars/"
tables = pd.read_html(url_mars_facts)
facts_df = tables[0] 
# tables

facts_df.columns = ["description", "value"]
facts_df.set_index("description")
# convert dataframe back to html
facts_df.to_html('table.html')
!open table.html<jupyter_output><empty_output><jupyter_text>Mars Hemispheres<jupyter_code>mars_url = "https://astrogeology.usgs.gov/search/results?q=hemisphere+enhanced&k1=target&v1=Mars"
browser.visit(mars_url)
hemisphere_image_urls = [
    {"title": "Valles Marineris Hemisphere", "img_url": "..."},
    {"title": "Cerberus Hemisphere", "img_url": "https://astrogeology.usgs.gov/search/map/Mars/Viking/cerberus_enhanced"},
    {"title": "Schiaparelli Hemisphere", "img_url": "https://astrogeology.usgs.gov/search/map/Mars/Viking/schiaparelli_enhanced"},
    {"title": "Syrtis Major Hemisphere", "img_url": "https://astrogeology.usgs.gov/search/map/Mars/Viking/syrtis_major_enhanced"},
]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13531703861140632, 'fraction_numerical': 0.0021253985122210413, 'mean_word_length': 7.583586626139818, 'pattern_counts': {'":': 8, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 8, 'lorem ipsum': 0, 'www.': 1, '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': '379884', 'license': 'ADSL', 'n_tokens_mistral': 1032, 'n_tokens_neox': 1001, 'n_words': 175, 'path': 'MissionToMars.ipynb', 'repo_name': 'mixtek/Webscraping_Mars', 'size': '2823'}