Skip to main content

Section 14.1 Scrape all the Cottage Inn Pizza locations

Let’s say that you want to make a list of all the Cottage Inn Pizza locations. When you go to their website, it turns out that there are a lot of locations.
Figure 14.1.1. Scrolling around the Cottage Inn locations page to see that there are a lot of locations
If only you could write a little Python to easily collect them all...
It turns out that you can!
Below is code to collect all the Cottage Inn Pizza locations. Instead of scraping the data from the live site we are using a saved web page from the way back machine which is a free archive of web pages. This is useful since live sites can change over time.

Activity 14.1.1.

Run the code below to see what data it collects
This code probably seems a bit complicated. In this ebook, we will break down web scraping into a few common "plans". This example is made up of three plans. Click on each of them to learn more.
You have attempted of activities on this page.