import requests from bs4 import BeautifulSoup
url = ' https://example.com ' response = requests . get ( url ) soup = BeautifulSoup ( response . text , ' html.parser ' )
# Extract title tag title_tag = soup . title print ( f " Title: { title_tag . string if title_tag else ' N/A ' } " )
# Extract meta description meta_desc = soup . find ( ' meta ' , attrs = { ' name ' : ' description ' }) print ( f " Description: { meta_desc [ ' content ' ] if meta_desc else ' N/A ' } " )
Enter fullscreen mode
Exit fullscreen mode
If you're a developer looking to automate SEO tasks, you've probably encountered the time-consuming nature of manual analysis. SEO is a critical part of digital marketing, but it's often tedious to check each website's metadata, headings, and other elements. That's where automation comes in.…