Facebook
From Katerina, 3 Years ago, written in Python.
Embed
Download Paste or View Raw
Hits: 55
  1.     BeautifulSoup(source)
  2.  
  3.     soup= BeautifulSoup(source, 'lxml')
  4.     article= soup.find('article')
  5.     headline= article.h2.a.text
  6.     summary = article.div.p.text
  7.  
  8.     print(headline)
  9.     print(summary)
  10.  
  11.     for article in soup.find_all('article'):
  12.         headline= article.h2.a.text
  13.         summary = article.div.p.text
  14.