Skip to content

Instantly share code, notes, and snippets.

@muhammedbasilsk
Forked from jineshpaloor/read_meta_data.py
Last active April 3, 2024 06:18
Show Gist options
  • Save muhammedbasilsk/36912695823a01a90eb1cac617f068ed to your computer and use it in GitHub Desktop.
Save muhammedbasilsk/36912695823a01a90eb1cac617f068ed to your computer and use it in GitHub Desktop.
python program to read a url and extract its meta tags
from BeautifulSoup import BeautifulSoup
import requests
def extract_meta(url):
r = requests.get(url)
print(dir(r))
soup = BeautifulSoup(r.text)
meta = soup.findAll('meta')
print(meta)
for tag in meta:
print(tag)
if __name__ == '__main__':
_url = 'http://www.sourcebits.com/'
extract_meta(_url)
@akashriyer9
Copy link

very helpful thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment