Closed SamratDey112358 closed 10 months ago
Are you using the latest version? I can see both .get_news() and .search() can return a list of result with latest version
Hi, am using version 1.6.9, just upgraded it
Try to use browser to open google and search something with same pc, and check whether Google does robot verification or not. This may be Google recognize your behaviour as robot and do extra verification, then will cause this issue. Otherwise it seems not code issue.
No I am not getting any message about Google doing robot verification, can search as usual on browser also same issue in multiple systems have also tried with different internet connections
user_agent = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:64.0) Gecko/20100101 Firefox/64.0'
headers = {'User-Agent': user_agent}
url='https://www.google.com/search?q=%3Cany%20keyword&lr=lang_en&biw=1920&bih=976&source=lnt&tbs=lr:lang_1en,qdr:10d,,sbd:1&tbm=nws&start=0'
req = urllib.request.Request(url.replace("search?","search?hl="+self.__lang+"&gl="+self.__lang+"&"), headers=headers)
response = urllib.request.urlopen(req)
page = response.read()
Try this code and see whether you can get the details
"self" is not defined, can I change it to "en"?
"self" is not defined, can I change it to "en"?
yes, just set your language
it ran, there is an output for page which is a huge chunk of string like this "b'<!doctype html>
googlenews.search("<any keyword") is giving "'NoneType' object is not iterable" in Python