Learning web scraping with Beautiful Soup Python Library
- Insatll necessary libraries
pip install beautifulsoup4 requests lxml
- Create a python application for scraping
import requests
from bs4 import BeautifulSoup
url = input("Url of the website you want to scrape: ")
req = requests.get(url)
soup = BeautifulSoup(req.content, "lxml")
res = soup.title # For scraping the title of website
print(res.get_text())
- Run the python file
python scraper.py
Now give the website url as input and you will be able too see the title
of the webiste in your terminal.
- Beautiful Soup Docs - https://www.crummy.com/software/BeautifulSoup/bs4/doc/
- Geekforgeeks Tutorial - https://www.youtube.com/watch?v=O6nnVHPjcJU&ab_channel=GeeksforGeeks
- FreedCamp Tutorial - https://www.youtube.com/watch?v=XVv6mJpFOb0&t=1280s&ab_channel=freeCodeCamp.org