Coder Social home page Coder Social logo

cmdenys / web-scraping-to-mars Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 8.38 MB

created a web application that scrapes various websites related to the recent mission to mars and displayed the data in a single HTML web page.

Jupyter Notebook 89.42% Python 4.98% HTML 5.46% CSS 0.14%
python-dictionary jupyter-notebook splinter mongo

web-scraping-to-mars's Introduction

Built a web application that scrapes various websites for data related to the Mission to Mars and displays the information in a single HTML page.

Step 1 - Scraping

Initital scraping was done using Jupyter Notebook, BeautifulSoup, Pandas, and Requests/Splinter.

Created a Jupyter Notebook file called mission_to_mars.ipynb and used it to complete all scraping and analysis tasks.

The following outlines what was scraped:

NASA Mars News

The first scrape is from the Nasa Mars site and consisted of the both the latest News Title and Paragraph Text.

JPL Mars Space Images - Featured Image

The second srape is of the JPL Featured Space Image. Splinter was used to navigate the site and find the image url for the current Featured Mars Image. Once found, the image url string was assigned a variable called featured_image_url.

Mars Facts

The third scrape is from the Mars Facts webpage and is a table of relevant facts. Pandas was used to scrape the table containing facts about the planet and data was then converted to an HTML table string.

Mars Hemispheres

The third scrape is from the USGS Astrogeology site and consists of high resolution images for each of Mar's hemispheres. A python dictionary was used to store the the data with a list containing one dictionary for each hemisphere. A for loop was used to append each dictionary with the hemisphere title and url string.


Step 2 - MongoDB and Flask Application

MongoDB with Flask templating was used to create a new HTML page that displays all of the scraped information collected above.

The initial jupyter notebook was converted into a Python script called scrape_mars.py with a function called scrape that executes the code above and returns one Python dictionary containing all of the scraped data.

Next, a route called scrape_mars.py was created to call the scrape function and the respective data related to Mission to Mars was returned and stored in Mongo as a Python dictionary.

Lastly, an html template was created to display the data passed on from the Mongo database.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.