Snippets Collections
#pip install beautifulsoup4

import os
import requests
from bs4 import BeautifulSoup

url = ""
reponse = requests.get(url)

if reponse.ok:
	soup = BeautifulSoup(reponse.text, "lxml")
	title = str(soup.find("title"))

	title = title.replace("<title>", "")
	title = title.replace("</title>", "")
	print("The title is : " + str(title))


#python (code name).py

Wed Sep 07 2022 13:53:49 GMT+0000 (UTC)

#python #webscraping #beautifulsuap4

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension