how to scrape from meta content code example
Example 1: retrieve content inside the meta tag python
title = soup.find("meta", property="og:title")
url = soup.find("meta", property="og:url")
print(title["content"] if title else "No meta title given")
print(url["content"] if url else "No meta url given")
Example 2: retrieve content inside the meta tag python
from urllib import urlopen
from bs4 import BeautifulSoup
def get_data(page_no):
webpage = urlopen('http://superfunevents.com/?p=' + str(i)).read()
soup = BeautifulSoup(webpage, "lxml")
for tag in soup.find_all("article") :
id = tag.get('id')
print id
title = soup.find("og:title", "content")
print (title.get_text())
url = soup.find("og:url", "content")
print (url.get_text())
for i in range (1,100):
get_data(i)