Exercise 1: News Article Scraper
Create a function that scrapes a news article and extracts: - Article title - Author name - Publication date - All paragraph text - Save the results to a text file
Hint: Try scraping from a news website like BBC News or CNN.
Exercise 2: Image URL Extractor
Create a script that: - Takes a URL as input - Extracts all image URLs from the page - Filters out very small images (e.g., icons, logos) - Saves the URLs to a file, one per line
Hint: Look for <img> tags and check the src attribute.
Exercise 3: Product Information Scraper
Scrape an e-commerce product page and extract: - Product name - Price - Description - Available sizes/colors (if any) - Rating (if available)
Hint: Try scraping from a simple e-commerce site or use a demo site like http://quotes.toscrape.com.
Exercise 4: Contact Information Extractor
Create a script that finds email addresses and phone numbers on a webpage using regular expressions.
Hint: Use Python's re module for pattern matching.
Solutions
Solutions are available in solutions/ directory. Try to solve the exercises yourself first!