Snippets Collections
#pip install beautifulsoup4

import os
import requests
from bs4 import BeautifulSoup

url = "https://www.google.com/"
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))

os.system("pause")

#python (code name).py
star

Wed Sep 07 2022 13:53:49 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

#python #webscraping #beautifulsuap4

Save snippets that work with our extensions

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