1

I have a python list:

['Facebook lawsuit', 'Google lawsuit', 'Whatsapp lawsuit',' Instagram lawsuit']

I need help looping through Google News to pull the top 5 news articles between [2022-01-01 to 2022-03-31]

Here's my code:

def gnews_search():
    from GoogleNews import GoogleNews
    news = GoogleNews(lang = 'en', period='90d')
    for x in list1:
        news.search(x)
        news.result()
        news.clear()
        for result in results: 
            print('\n\nTITLE:',result['title'],
            '\nDESC:',result['desc'],
            '\nURL:',result['link'])

However, when I use the above code, I am getting an error that says 'Too many requests'? Is there a way I can sleep the process for two seconds and run it for the next item in the list and so forth from the above code?

omgpython
  • 15
  • 4
  • 2
    If you ran your code more than 25 times then you may have exceeded the 100 requests per day limit for the free developer account. – CodeMonkey Apr 03 '22 at 21:57
  • You can try https://newscatcherapi.com/ which gives 10,000 calls 1 API call/second for free – checked Apr 03 '22 at 22:20

0 Answers0