Git Product home page Git Product logo

webscrapingcfcbs4's Introduction

Web Scraping with Beautiful Soup — A Use Case

You can find the Towards Data Science article at https://towardsdatascience.com/web-scraping-with-beautiful-soup-a-use-case-fc1c60c8005d

Intro

In this notebook, I will give a brief introduction to obtaining data from a webpage, i.e., web scraping, using Python and libraries such as Requests to get the data and Beautiful Soup to parse it. Web scraping becomes necessary when a website does not have an API, or one that suits your needs.

As an example, I use a webpage that has a consistent HTML structure, but this approach can be generalized. While there are some frameworks, such as Scrapy, that can provide such service, I decided to this as a learning experience.

The Use Case

A not-for-profit organization wants to reach out to the Community Foundations of Canada (CFC) sites across the nation. They asked me to find each contact person and their mailing address, and put all the information in a special format in a spreadsheet.

Doing this task manually, by copy-pasting each required field into the spreadsheet, would mean doing this 195 (foundations) * 11 (fields) = 2145 times! So my next thought was to automate the procedure by scraping the CFC website.

Here is the code used to scrape their website, get the requested information, and write it in the format requested into a CSV file.

webscrapingcfcbs4's People

Contributors

brodriguezmilla avatar

Watchers

James Cloos avatar

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.