Answers for "python requests get title"

0

python requests get title

#!/bin/python
import requests
from bs4 import BeautifulSoup

response = requests.get("https://www.example.com")

if repsonse.status_code == 200:
	soup = BeautifulSoup(response.content, "html.parser")

	# will only find the first match, presumably the page title
	title = soup.find("title").get_text()
Posted by: Guest on October-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language