Meta tags are HTML tags that provide information about a web page to search engines and other web services. They are placed in the <head> section of a web page and provide information such as the page's description, keywords, author, and more.
To extract meta tags from a web page, you can use a tool such as a web scraper or a browser's developer tools.
For example, using a web scraper, you can send a request to a website's URL and extract the meta tags from the HTML source code of the page. Here is an example using Python and the requests and BeautifulSoup libraries:
- python
import requests
from bs4 import BeautifulSoup
url = "https://www.example.com"
response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")
meta_tags = soup.find_all("meta")
for tag in meta_tags:
print(tag.attrs)
This code sends a request to the URL https://www.example.com, extracts the HTML source code, and uses BeautifulSoup to parse the HTML. The find_all method is then used to search for all meta tags, and the attrs property is used to print the attributes of each tag.
You can also use the developer tools in your browser to inspect a web page and view its meta tags. To do this, right-click on the page and select "Inspect" (or press Ctrl + Shift + I in Chrome). Then, navigate to the "Elements" tab to view the HTML source code, and look for the meta tags in the <head> section.