Skip to content

Instantly share code, notes, and snippets.

@yurivictor
Created February 2, 2012 07:57
Show Gist options
  • Save yurivictor/1722261 to your computer and use it in GitHub Desktop.
Save yurivictor/1722261 to your computer and use it in GitHub Desktop.
Python gets meta information from a link
import re, requests
def get_meta_tags(url):
meta = {}
response = requests.get(url)
html = response.content
search = re.findall("name=\"([^\"]*)\" content=\"([^\"]*)\"", html)
for i in search:
meta[i[0]] = i[1]
return meta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment