🔗Web Scraping
Also known as Scraping, Web Scraper, Screen Scraping, Data Scraping
A program that reads web pages and copies data out of them.
Think of it like
Think of it like copying prices from shop windows. A robot walks down the street and writes them down.
Example
Jack scrapes the prices of 50 bikes from a shop's pages each night. His sheet now tracks every price change.
Why it matters
A lot of useful data lives only on web pages. Scraping is often the only way to collect it.
Definition
Example code
python
import requests
from bs4 import BeautifulSoup
page = requests.get("https://example.com/bikes")
soup = BeautifulSoup(page.text, "html.parser")
prices = [p.text for p in soup.select(".price")]Common mistake
Key takeaways
- 1Read the page. Load it like a browser would.
- 2Pick the parts. Find the data and save it.
- 3Be polite. Go slow and follow the site's rules.