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

Cookie: NID and __Secure-ENID #85

Open
ybeltukov opened this issue Aug 20, 2024 · 3 comments
Open

Cookie: NID and __Secure-ENID #85

ybeltukov opened this issue Aug 20, 2024 · 3 comments

Comments

@ybeltukov
Copy link

I could not fetch the book after PR #81. I have an old NID cookie instead of __Secure-ENID. Maybe it depends on the region or the system.

Is it possible take into account both types of cookies?

@athulsec
Copy link

"name='__Secure-ENID', domain=None, path=None"
Received invalid response

@timea-techgirl
Copy link

python GoBooDo.py --id=32LAEAAAQBAJ

"name='__Secure-ENID', domain=None, path=None"
Received invalid response

@QuentinX5
Copy link

QuentinX5 commented Oct 21, 2024

For anyone still trying to resolve this, you can adjust the GoBooDo.py and storeImages.py to set multiple cookies like this (pulled this from GoBooDo.py, can use similar code in storeImages.py):

NIDstr = req.cookies.get('NID')
SecureENIDstr = req.cookies.get('__Secure-ENID')
CookieStr = ""
if ((NIDstr == None) and (SecureENIDstr != None)):
    CookieStr = "__Secure-ENID=" + SecureENIDstr
elif ((NIDstr != None) and (SecureENIDstr == None)):
    CookieStr = "NID=" + NIDstr
else:
    CookieStr = "NID=" + str(req.cookies.get('NID') + ";__Secure-ENID=" + str(req.cookies.get('__Secure-ENID')))

self.head = {
    'Host': 'books.google.'+self.country,
    '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',
    'Cookie': CookieStr,
            }

Note the CookieStr being used instead of the hardcoded string in the self.head value

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

4 participants