Beautiful Soup – BS4

pip3 install bs4
  • requests.get(URL).text – returns the text from a web page
  • find_all() – finds all instances of a tag
  • get_text() – removes the tags from text
import requests
from bs4 import BeautifulSoup

url = "https://WEBPAGE"
page = requests.get(url)

soup = BeautifulSoup(page.text,"html.parser")
item = soup.find_all('p')

print(url)
print(soup.title.get_text())
for x in item:
      print(x.get_text())
Code language: JavaScript (javascript)