Iceloof / GoogleNews

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

Empty list always returned #5

Closed akeklak closed 4 years ago

akeklak commented 4 years ago

Hi,

Thanks for making this module. Unfortunately, I only get empty lists returned when trying to make searches. Any thoughts to what the issue might be? I've tried the basic example below:

from GoogleNews import GoogleNews googlenews = GoogleNews() googlenews.search('APPL') news = googlenews.result() print(news)

HurinHu commented 4 years ago

"from GoogleNews import GoogleNews" not "import GoogleNews from GoogleNews" and it will gets result. If you run code behind proxy, please remember set the proxy in code for network request.

akeklak commented 4 years ago

Sorry, that was a typo (and would also return a syntax error, it's not the issue). I'm just running the script directly from my laptop, and do not have any proxy servers configured. I assume it's still working if you try it? Thanks for the quick response!

HurinHu commented 4 years ago

Well, I have tried it again, it works. The problem might be your environment, if your public ip doing to much things and google need to verify you are not robot, try to open google on you browser and check it right or not.

akeklak commented 4 years ago

I am able to access google in my browser, and tried using the format of the URL contained in the self.url variable (self.url="https://www.google.com/search?q="+self.key+"&tbm=nws&start=%d") with "+self.key+" replaced by my search term, and the search is successful. Any other thoughts on how to troubleshoot? Thanks again.

HurinHu commented 4 years ago

No idea about that, the only issue I found is google trying to verify you are not robot.

akeklak commented 4 years ago

Ok. I will try it out from a hosted virtual linux machine instead, hopefully that works. In general, what does it take for Google to classify you as a robot using this module? I.e., is it a number of search requests per day, or a certain number in very quick succession? Thanks again for the help!

HurinHu commented 4 years ago

mostly it will depends on your public IP, like if you are doing it on your VPS or send several request within a second , it will be a big chance to have this issue

akeklak commented 4 years ago

Ok, I'll add some time delays in my script then. Gonna close the issue now - thanks one last time!

Q-Tran commented 4 years ago

Also having the same issue. Added delays and same result occurred. Went to google news and entering the data manually was fine.