FailSpy / humble-steam-key-redeemer

Python script to extract all Humble Bundle keys and redeem them on Steam automagically.
133 stars 28 forks source link

Script silently fails when timed out on login API request when 403'd from Cloudflare #42

Open WittyjonWitty opened 1 year ago

WittyjonWitty commented 1 year ago

Script times out after hanging on login, after HB username and password have been entered. See log below

Traceback (most recent call last): File "D:\git\steamredeem\humble-steam-key-redeemer\humblesteamkeysredeemer.py", line 907, in humble_login(driver) File "D:\git\steamredeem\humble-steam-key-redeemer\humblesteamkeysredeemer.py", line 276, in humble_login auth,login_json = do_login(driver,payload) ^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\git\steamredeem\humble-steam-key-redeemer\humblesteamkeysredeemer.py", line 246, in do_login auth,login_json = perform_post(driver,HUMBLE_LOGIN_API,payload) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\git\steamredeem\humble-steam-key-redeemer\humblesteamkeysredeemer.py", line 131, in perform_post return driver.execute_async_script(fetch_cmd.format(formData=json_payload,url=url,csrf=csrf)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Jwitt\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 423, in execute_async_script return self.execute(command, {"script": script, "args": converted_args})["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Jwitt\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute self.error_handler.check_response(response) File "C:\Users\Jwitt\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: script timeout (Session info: chrome=118.0.5993.89) Stacktrace: GetHandleVerifier [0x00007FF7E0468EF2+54786] (No symbol) [0x00007FF7E03D5612] (No symbol) [0x00007FF7E028A4FD] (No symbol) [0x00007FF7E0305A0A] (No symbol) [0x00007FF7E02EBE6A] (No symbol) [0x00007FF7E0304D02] (No symbol) [0x00007FF7E02EBC43] (No symbol) [0x00007FF7E02C0941] (No symbol) [0x00007FF7E02C1B84] GetHandleVerifier [0x00007FF7E07B7F52+3524194] GetHandleVerifier [0x00007FF7E080D800+3874576] GetHandleVerifier [0x00007FF7E0805D7F+3843215] GetHandleVerifier [0x00007FF7E0505086+694166] (No symbol) [0x00007FF7E03E0A88] (No symbol) [0x00007FF7E03DCA94] (No symbol) [0x00007FF7E03DCBC2] (No symbol) [0x00007FF7E03CCC83] BaseThreadInitThunk [0x00007FFDB171257D+29] RtlUserThreadStart [0x00007FFDB208AA78+40]

FatePony commented 1 year ago

I am getting the same error, but I've already logged in and was re-running it after this month's drop. Deleting the session files did not fix it. This error seems to be the culprit, selenium.common.exceptions.TimeoutException: Message: script timeout. My stacktrace is the same as you.

N1ghtm4r3x commented 1 year ago

Download this chromedriver 114.0.5735.90 for windows, unzip it and place the chromedriver in the same folder as the python script, it should work after that.

FailSpy commented 9 months ago

This is due to Chrome v115 and above becoming quite obvious to Cloudflare's bot detection with their new 'Chrome for Testing' mode. I'm working on a fix to make it so this doesn't fail so silently going forwards.

As a hotfix, I've made it so the script prefers FirefoxDriver as that seems to be working still. Then rely on Selenium Manager to hopefully magically make that work on most users machines.

I'm leaving this issue open for now until I fix the quiet failure mentioned here, and hopefully at that point also have a better answer for going forwards.