<p> ==$0 "1."the purpose of our lives is to be happy." - " <strong>Dalai Lama</strong> </P>
import requests from bs4 import BeautifulSoup from pprint import pp def main(url): r = requests.get(url) soup = BeautifulSoup(r.text, 'lxml') x = [x.get_text(strip=True, separator=" ") for x in soup.select( 'span[data-parade-type="promoarea"] .figure_block ~ p')] goal = [i for i in x if i[0].isdigit()] pp(goal) main('https://parade.com/937586/parade/life-quotes/')
Note, If you are using Windows machine, DO NOT forget to include from_encoding= equal to the encoding used by your sys.
Windows
Ref: https://www.crummy.com/software/BeautifulSoup/bs4/doc/#encodings
Otherwise:
print(" ".join(goal))
1.4m articles
1.4m replys
5 comments
57.0k users