Beautiful Soup is a python package for parsing HTML. Beautiful Soup was started by Leonard Richardson.
Website reference: https://www.crummy.com/software/BeautifulSoup/
Steps:
- You can install Beautiful Soup 4 with
pip install beautifulsoup4
.
Simple Example for BS4:
from bs4 import BeautifulSoup
from urllib.request import urlopen
with urlopen(‘http://www.khojle.in/’) as response:
soup = BeautifulSoup(response, ‘html.parser’)
for anchor in soup.find_all(‘a’):
print(anchor.get(‘href’, ‘/’))
Take an example of one website :
Right-click on this website and click on Inspect
For more details, Please find the code details:
https://github.com/saiswarup/Webscraping-Beautifulsoup_Python