Step 1. Install pygooglenews
$ pip install pygooglenews
Step 2. Three lines to get news data
from pygooglenews import GoogleNews gn = GoogleNews(lang = 'en', country = 'US') # latest news on Amazon that got published over the last hour news = gn.search('Amazon', when = '1h')
- You get data from Google — the best search engine
pygooglenews hits RSS feed URL (not the UI URL). So, you don't get blocked by scraping Google
Google’s RSS can have up to 100 articles. But, Google allows you to specify that you want to see only the articles from the past hour.
Make such a request a few times an hour, and you will not miss a single news article that mentions your company/person of interest.