Mission to Mars was a project I worked on to highlight web scraping. I used Beautiful Soup in order to browse the Mars Exploration Program’s website and pull the most recent news title and summary paragraph. I also scraped the Jet Propulsion Laboratory’s website to collect the most recent picture of Mars. This would provide a nice esthetic to the page. The Mars Weather Twitter was also scraped, which provided the most recent weather data collected by the Mars Curiosity rover. The pictures of each hemisphere on Mars were scraped from the USGS Astrogeology Science Center website.
The code to scrape the websites was created using Python. I tested the code in a Jupyter Notebook. This allowed me to scrape the page live, find the HTML tags I would need to target, design the code to clean the data collect, and finally save the data to variables that the app would call later to present on the website.
The scraping function was saved to a file called scrape.py and app.py would initialize the Flask app which could be ran locally. Once the Flask app was running, you could open the page locally and hit the “Scrape New Data” button on the website. This would call the function scrape to run and begin the process of extracting, transforming, and loading the new data into the visually appealing HTML format.
Please click here to view Mission to Mars on GitHub.