GoBooDo
GoBooDo copied to clipboard
list index out of range | KeyError: 'page'
Trying to make it work on windows 10, python 3.9.9
Initially, I had no error prompted, just this output:
"name='NID', domain=None, path=None"
Received invalid response
After adding Exception and traceback printing to start function (line 163), I eventually noticed a strange issue with the self.head was not set in the rest of the program, even if I call resethead(), self.head still doesn't exist.
So I add a self.head definition in the init function of the class. Now I got an error similar as other issues reported here.
Traceback (most recent call last):
File "C:\Users\Pelle\code\GoBooDo\GoBooDo.py", line 163, in start
self.getInitialData()
File "C:\Users\Pelle\code\GoBooDo\GoBooDo.py", line 94, in getInitialData
stringResponse = ("["+scripts[-4].text.split("_OC_Run")[1][1:-2]+"]")
IndexError: list index out of range
I tried to replace the code as suggested in #60 but now I had this error log:
Traceback (most recent call last):
File "C:\Users\Pelle\code\GoBooDo\GoBooDo.py", line 162, in start
self.getInitialData()
File "C:\Users\Pelle\code\GoBooDo\GoBooDo.py", line 95, in getInitialData
self.createPageDict(jsonResponse)
File "C:\Users\Pelle\code\GoBooDo\GoBooDo.py", line 74, in createPageDict
for pageData in jsonResponse[0]['page']:
KeyError: 'page'
I don't know what the jsonResponse
should be but I've printed it and there is no attribute "page".
As suggested to me, I've tried the fork made by memerememe but no change yet. I also tried different countries including mine in the settings.json (I'm in France).
I saw a reply to on one of a similar issue raised in the issues page which said, using a vpn fixed it for them or using a proxy.txt file and setting the settings.conf "proxy_links" and "proxy_images" to 1.
Another proposed fix is also uncommenting the faulty line(however not recommended as possible "risky" as mentioned by the person): https://github.com/vaibhavk97/GoBooDo/issues/57
I tried it with a vpn for italy, germany and UK but the error has not changed. I also tried the suggestion of #57 and It's test code give me an error : Traceback (most recent call last):
File "test.py", line 12, in <module>
print(req.cookies['name'])
File "/home/pl/.pyenv/versions/3.7.11/lib/python3.7/site-packages/requests/cookies.py", line 328, in __getitem__
return self._find_no_duplicates(name)
File "/home/pl/.pyenv/versions/3.7.11/lib/python3.7/site-packages/requests/cookies.py", line 399, in _find_no_duplicates
raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
KeyError: "name='name', domain=None, path=None"
When I comment the 58 line 'Cookie': "NID=" + str(req.cookies['NID']),
the output
"name='NID', domain=None, path=None"
is replaced by
{'Host': 'books.google.it', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.00', 'Accept': '*/*', 'Accept-Language': 'en-US,en;q=0.5', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'close'}
but It's still stucked on a KeyError: 'page'
I may specify that I tried those tests on both @vaibhavk97 and @memerememe versions, with same results.
maybe this will help https://github.com/vaibhavk97/GoBooDo/issues/63#issuecomment-1045965832 req = requests.get("https://google."+self.country, cookies={'CONSENT': 'YES+1'}, verify=False)