Sitemap
TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Member-only story

How to Scrape Multiple URLs with Python: Tutorial

5 min readJun 3, 2020

--

Press enter or click to view image in full size
Source

In this article, I will show you three ways to scrape data from multiple URLs. More specifically, I will show how to loop over the page number, loop over a manually created list of URLs and finally, loop over a scraped list of URLs.

I am assuming in this tutorial that you have some super basic knowledge of web scraping. If you need a quick refresher on how to inspect and scrape a website, check this out.

I will be scraping data from hostels in the beautiful city of Barcelona from Hostelworld, the best website to find hostels anywhere in the world. Alright, now let’s begin!

Looping over the page number

This is the simplest, most straightforward way of scraping multiple pages. Let’s begin by looking at the end of the URL we are scraping the hostels from (full URL available at the end of the article):

--

--

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.