Mastering Development

Scraping Google News with pygooglenews

I am trying to do scraping from Google News with pygooglenews.
I am trying to scrape more than 100 articles at a time (as google sets limit at 100) by changing the target dates using for loop. The below is what I have so far but I keep getting error message

"TypeError: unsupported operand type(s) for +=: 'dict' and 'str'".
import pandas as pd
from pygooglenews import GoogleNews
import datetime

gn = GoogleNews()

def get_news(search):
    stories = []
    start_date =,3,1)
    end_date =,3,5)
    delta = datetime.timedelta(days=1)
    date_list = pd.date_range(start_date, end_date).tolist()
    for date in date_list[:-1]:
        search =, from_=date.strftime('%Y-%m-%d'), to_=(date+delta).strftime('%Y-%m-%d'))
        newsitem = search['entries']

        for item in newsitem:
            story = {

    return stories

df = pd.DataFrame(get_news('Banana'))

Thank you in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *