Skip to content

Instantly share code, notes, and snippets.

@theawesomenayak
Created October 12, 2020 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theawesomenayak/a9a5c9c3b812c3a7f96651dd67b240c8 to your computer and use it in GitHub Desktop.
Save theawesomenayak/a9a5c9c3b812c3a7f96651dd67b240c8 to your computer and use it in GitHub Desktop.
def get_news_from_google():
client = urlopen(news_url)
page = client.read()
client.close()
souped = soup(page, "xml")
news_list = souped.findAll("item")
result = []
for news in news_list:
data = {}
data['title'] = news.title.text
data['date'] = news.pubDate.text
result.append(data)
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment