Project Overview 💡
In this project, you'll learn how to use the requests
and BeautifulSoup
libraries to scrape the introductory paragraphs of a Wikipedia page and save them to a text file. This is a great beginner project for learning web scraping with Python.
Challenge Yourself! 🚀
Before checking the solution, try writing a script that fetches a Wikipedia page and extracts its first few paragraphs.
Task:
Write a Python script that:
Sends a request to a Wikipedia article URL
Parses the HTML content
Extracts the first four paragraphs
Saves the text to a text file
Expected Output:
The program should save the first four paragraphs in a text file:
Give it a shot! Scroll down when you're ready for the step-by-step guide.