Iceloof / GoogleNews

Script for GoogleNews
https://pypi.org/project/GoogleNews/
MIT License
314 stars 88 forks source link

googlenews.search() takes too long #80

Closed SamratDey112358 closed 2 years ago

SamratDey112358 commented 2 years ago

Hi, we are using GoogleNews package to extract news for recurring newsletters in our organization. Since today we are observing that the search() function is taking extremely long time (at least 10-15 minutes for single one-word query). Can anyone please advise

HurinHu commented 2 years ago

Are you getting a lot of pages at one time? The current function is not doing any retries during fetching, so it shouldn't take that long, probably you might need to check the network connection, try fetching https://www.google.com/search?q=apple though urllib.request.

SamratDey112358 commented 2 years ago

Hi, thanks for your reply! We have a list of keywords and a date range for which we are fetching only news items. We are using the code: gn = GoogleNews(start,end) gn.search(item) result = gn.result() This fetches about 10 URLs and other details for each keyword. We have 10-20 keywords on average. Previously it was taking maybe 1 or 2 seconds for each keyword, since last 2 days it's taking several minutes. We have checked on different laptops as well as using different internet connections. The line of code you shared seems to be getting all items, we require exclusively news items ( search results under news tab in google search). Can you please suggest why this latency may be happening? Thank you!

anicoll44 commented 2 years ago

Hi, I also am experiencing the same recent latency issue as @SamratDey112358

SamratDey112358 commented 2 years ago

Hi, can you please help on this if possible. Thanks

HurinHu commented 2 years ago

I have fixed that issue with updated version 1.6.0, please update to latest version with pip install --upgrade GoogleNews