Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My search results return fewer news than I expect, is this normal? #19

Open
laurence-lin opened this issue Jun 16, 2021 · 2 comments
Open

Comments

@laurence-lin
Copy link

laurence-lin commented Jun 16, 2021

Thank you for the great tool! I would like to scrap large scale news data from google news, however when I use the keyword 'covid' to get the response for 48 months, I got only 100 news data.
Is that normal? I don't think google news have that less data related to the topic, or does the API limits the amounts of response? Here is my code:

gn = GoogleNews()
search = gn.search("covid", when = '60m') # 設定關鍵字

all_news = search['entries']

print("There are totally {} news".format(len(all_news)))
@jbxiang
Copy link

jbxiang commented Aug 10, 2021

The limited data per time is 100 constrained by Google.

@astavri
Copy link

astavri commented Jan 28, 2022

workaround: If you loop each search by day and define day ranges earlier on, you are not constrained by the limits of what Google reports per search. You need datetime for this.

from datetime import datetime, timedelta

while min_date != max_date: #While loop conditions set to run dates from min to max, adding a day for each
min1_date = min_date + timedelta(days=1)
print("From:"+min_date.strftime('%Y-%m-%d'));
print("To:"+min1_date.strftime('%Y-%m-%d'));
search = gn.search(searchlist[i], from_=min_date.strftime('%Y-%m-%d'), to_=min1_date.strftime('%Y-%m-%d'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants