Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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()
 
PREVIOUS NEXT
Tagged: #python #requests #title
ADD COMMENT
Topic
Name
5+6 =