eddie3 / gogrepo

Python-based tool for downloading all your GOG.com game and bonus collections to your local computer for full offline enjoyment.
481 stars 114 forks source link

Login always fails with "cannot continue, gog is asking for a reCAPTCHA :( try again in a few minutes." #65

Open oriwheb opened 1 year ago

oriwheb commented 1 year ago

As title says, I can never manage to log in via gogrepo, and had to edit the cookie manually with the new tokens from my GOG Galaxy cookies.

I tried multiple times over several days and the same error always occurs. I considered that this may be the cause for my other issue, but I can fetch the game pages, so it seems like I did alright... Unless using the Galaxy cookies causes the server to provide a different response which this client isn't built to handle.

eddie3 commented 1 year ago

Hi. If you import them from your web browser after you've logged in, it should work.

oriwheb commented 1 year ago

And it does. I'm just wondering if this is fixable... Maybe change the login function to a cookie import one? Maybe that's a bit too involved.

CalAlaera commented 1 year ago

Hi. If you import them from your web browser after you've logged in, it should work.

This didn't fix the problem for me. I copied my cookies from my web browser into gog-cookies.dat as instructed (incidentally, they did look rather different, no mention of Galaxy in my browser's cookiejar, but anyway), and I get the following output:


$ python3 ./gogrepo.py -v
gogrepo.py (version 0.3a)
$ python3 ./gogrepo.py update
07:30:10 | loading local manifest...
07:30:10 | fetching game product data (page 1)...
07:30:11 | failed to load product data (are you still logged in?)
$ python3 ./gogrepo.py login
Username: <redacted>
Password:
07:31:08 | attempting gog login as '<redacted>' ...
07:31:13 | cannot continue, gog is asking for a reCAPTCHA :(  try again in a few minutes.
07:31:13 | exiting...
$
oriwheb commented 1 year ago

Did you use an extension to export the cookie?

My easy guess is that you entered the data in the wrong format, and not the format the script expects and can handle.

CalAlaera commented 1 year ago

Did you use an extension to export the cookie?

Not at first - I transferred them manually.

I have just tried again with EditThisCookie, exporting into LWP format as expected by the script. The exported cookies look like this:

Set-Cookie3: csrf=true; path="/"; domain=.gog.com; path_spec; expires="1660199187.824337"; version=0
Set-Cookie3: gog_lc=GB_GBP_en-US; path="/"; domain=.gog.com; path_spec; expires="1691130419.40648"; version=0

and so on. Same result.

DerPit commented 1 year ago

My browser shows me two possible cookies, one for www.gog.com, and one for gog.com. You need the latter, for gog.com. I use Extension 'Export Cookies' (for Chrome/Vivaldi), and a perl script to convert

CalAlaera commented 1 year ago

My browser shows me two possible cookies, one for www.gog.com, and one for gog.com. You need the latter, for gog.com. I use Extension 'Export Cookies' (for Chrome/Vivaldi), and a perl script to convert

I wasn't able to find the extension you mentioned in the Chrome extension store. However, I am fairly confident that this isn't the problem. I have now tried www.gog.com, .gog.com, and even copying all the cookies and editing the domain name to just plain gog.com with and without the leading dot. I also tried exporting my cookies in Mozilla cookies.txt format, which the script says it can handle (nice feature, by the way), and I started getting weird errors from cookiejar.py.

I've logged out and back in in my browser to refresh my cookies (notably, I wasn't asked to complete a captcha).

If someone would be willing to provide their working gog-cookies.dat (with the keys intact but values redacted for obvious reasons), I could adjust my own to match, and try it that way?

oriwheb commented 1 year ago

What worked for me was copying just the token values and expiration dates into the cookie .dat file.

@CalAlaera Your dates are epoch encoded. Try using the plaintext ones instead: "11-08-2022 6:26:27Z" "04-08-2022 09:36:05Z"

Convert your other dates as well here.

CalAlaera commented 1 year ago

@CalAlaera Your dates are epoch encoded. Try putting the plaintext ones instead: "11-08-2022 6:26:27Z" "04-08-2022 09:36:05Z"

Bingo, this appears to have fixed the problem, I am currently running an update and it appears to be working perfectly now.

It turns out I needed to use the format "2023-08-04 06:08:16". I set all my cookies with that expiry, and it didn't work. I then duplicated all my cookies and changed the domain on the second copy to precisely "gog.com", and suddenly, it's working.

Just in case it helps anyone else with a similar problem, my gog-cookies.dat file now looks like this (values redacted for obvious reasons):

#LWP-Cookies-2.0
Set-Cookie3: _abck=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: ak_bmsc=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: bm_sv=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: bm_sz=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: cart_token=<redacted>; path="/"; domain=.gog.com; path_spec; expires="0"; version=0
Set-Cookie3: csrf=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: gog_lc=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: gog_us=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: gog-al=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: _abck=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: ak_bmsc=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: bm_sv=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: bm_sz=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: cart_token=<redacted>; path="/"; domain=gog.com; path_spec; expires="0"; version=0
Set-Cookie3: csrf=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: gog_lc=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: gog_us=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0
Set-Cookie3: gog-al=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-08-04 06:08:16"; version=0

Thanks for your help. :)

Edited to add: Yes, this has absolutely fixed the problem, the script is now working perfectly. Thanks again. :)

x2601 commented 1 year ago

Odd. I followed the instructions including converting the date format and adding the just "gog.com" domain copies, but it's still prompting me for the reCAPTCHA.

#LWP-Cookies-2.0
Set-Cookie3: _abck=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: ak_bmsc=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: bm_mi=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: bm_sv=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: bm_sz=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: cart_token=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: csrf=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: gog_lc=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: gog_us=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: gog-al=<redacted>; path="/"; domain=.gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: _abck=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: ak_bmsc=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: bm_mi=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: bm_sv=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: bm_sz=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: cart_token=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: csrf=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: gog_lc=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: gog_us=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
Set-Cookie3: gog-al=<redacted>; path="/"; domain=gog.com; path_spec; expires="2023-09-16 10:09:52"; version=0
MattMills commented 1 year ago

Fyi @eddie3 I commented out the code that checks for the recaptcha div and it logged me in fine, so I'd say looking for that div is not a valid way to determine if they're asking for a captcha.

x2601 commented 1 year ago

Fyi @eddie3 I commented out the code that checks for the recaptcha div and it logged me in fine, so I'd say looking for that div is not a valid way to determine if they're asking for a captcha.

This also worked for me.

Avatar007z commented 1 year ago

Commenting out the div lookup for reCAPTCHA solved the issue for me. Otherwise I was going down the rabbit hole of exporting and modifying cookies.

eddie3 commented 1 year ago

Thanks! I've removed the check for now and will revisit in the future.