Fabbi / autoshift

automatic SHiFT code redemption scriptâ„¢
GNU General Public License v3.0
64 stars 23 forks source link

Change SHiFTCODE Source, fix universal bug and redemption output bug #54

Open ugoogalizer opened 1 year ago

ugoogalizer commented 1 year ago
flammable commented 1 year ago

Thanks for the fixes and the new Docker image!

I swapped out @Fabbi's image for yours, and I'm seeing a bunch of errors when I try to run it:

2023-10-03 02:32:08,789 [INFO]     Key #15/28 for bl3 on steam
2023-10-03 02:32:08,789 [INFO]     Trying to redeem 3 Golden Keys (XFXJB-3BBJT-B3BJB-3JJ3B-F5X96) on steam
2023-10-03 02:32:08,824 [DEBUG]    shift:213 - GET https://shift.gearboxsoftware.com/home?redirect_to=https%3A%2F%2Fshift.gearboxsoftware.com%2Fcode_redemptions%2Fnew 200
2023-10-03 02:32:08,862 [DEBUG]    shift:251 - GET https://shift.gearboxsoftware.com/home?redirect_to=https%3A%2F%2Fshift.gearboxsoftware.com%2Fentitlement_offer_codes 200 OK
2023-10-03 02:32:08,865 [DEBUG]    shift:259 - Count not find new_archway_code_redemption: <!DOCTYPE html>
(a lot of HTML)
2023-10-03 02:32:08,865 [DEBUG]    auto:51 - Status: Status.UNKNOWN
2023-10-03 02:32:08,865 [INFO]       <!DOCTYPE html>
(more HTML)
2023-10-03 02:32:08,865 [INFO]     Trying to prevent a 'too many requests'-block.

I'm going to blow away the database to see if that's the issue. Anything else I can try?

It looks like the HTML might contain account-specific details. If you need them to determine what's wrong, please let me know. I'll try to sanitize it to post here, or I can email you the entire output. Thanks again!

flammable commented 1 year ago

Oh, and it eventually finishes with:

2023-10-03 02:36:17,976 [INFO]     No more keys left!
2023-10-03 02:36:17,977 [INFO]     Scheduling to run every 12:00 hours

However, when I visit https://shift.gearboxsoftware.com/rewards, none of the new keys have been redeemed.

ugoogalizer commented 1 year ago

2023-10-03 02:32:08,789 [INFO] Trying to redeem 3 Golden Keys (XFXJB-3BBJT-B3BJB-3JJ3B-F5X96) on steam 2023-10-03 02:32:08,824 [DEBUG] shift:213 - GET https://shift.gearboxsoftware.com/home?redirect_to=https%3A%2F%2Fshift.gearboxsoftware.com%2Fcode_redemptions%2Fnew 200 2023-10-03 02:32:08,862 [DEBUG] shift:251 - GET https://shift.gearboxsoftware.com/home?redirect_to=https%3A%2F%2Fshift.gearboxsoftware.com%2Fentitlement_offer_codes 200 OK 2023-10-03 02:32:08,865 [DEBUG] shift:259 - Count not find new_archway_code_redemption: <!DOCTYPE html>

Hey mate,

This looks like an error type I've not seen back from the SHiFT Redemption website. I definitely added the extra debugging (including that typo) that's outputting the returned HTML from the SHiFT Code redemption site, but from what I can tell this is an issue that would have occurred in the original (just with less verbose logging). My code isn't yet removing expired codes (I'm close to it) but at least the XFXJB-3BBJT-B3BJB-3JJ3B-F5X96 one you're showing in your example is still valid.

Are you seeing any SUCCESS results in the log for codes? Or are they all like this?

Did you see anything different when you dropped db and retried?

Can you see what the SHiFT Code Website says when you manually try to redeem XFXJB-3BBJT-B3BJB-3JJ3B-F5X96? Suspect it may just be ALREADY REDEEMED, but it may give us more of a clue. Its supposed to return a form of class form of class new_archway_code_redemption and that's what's not being found here - perhaps because it's a redirect?

ugoogalizer commented 1 year ago

<!DOCTYPE html>

And yeah @flammable , to have any chance of understanding that issue I think I (or someone) would need to read through the HTML that's coming back. Account details etc no issue to remove (although I don't think any sensitive passwords etc would be included).

flammable commented 1 year ago

Sorry, been swamped! I swapped the folder (so it created fresh keys.db and .cookies.save files) and everything works great. Thanks again for the updated code and Docker image!

ugoogalizer commented 1 year ago

Extended the PR to handle a new Key boolean attribrite of expired that tracks whether the code has expired or not accordingy to the Mental Mars website. Autoshift then ignores those expired keys upon redemption. Unfortunately this was a breaking change due to how autoshift handles keys, so you'll have to grab the updated container @flammable

ugoogalizer commented 1 year ago

Damn, I didn't realise renaming a branch would close this PR. Fixed. I'm still keen for this PR to proceed if authorised/appropriate, but in the meantime have created a new branch in my fork to document how people can consume my interim version.

flammable commented 11 months ago

@Fabbi Hey Fabbi, have you had a chance to look at this? I've been using @ugoogalizer's Docker image for a while now and it works great (thanks!).

flammable commented 3 months ago

Gearbox dropped a bunch of codes the other day, and this fork handled them all perfectly. Thanks!

Dylancyclone commented 2 months ago

Hello!

I'm having the same issue that flammable was having before, where the docker container would boot up, return Status.UNKNOWN for each key, and then say "no more keys", but none of them seem to be redeemed.

I tried deleting the data folder, so keys.db and .cookies.save would be recreated, but unfortunately. I also did try manually redeeming one of the keys, which worked.

2024-08-21 14:29:53,580 [INFO]     Key #30/48 for bl2 on steam
2024-08-21 14:29:53,581 [INFO]     Trying to redeem Zer0 Community Day Skin + 5 Golden Keys (53KBB-KXXRC-RZ66Z-WFJBB-WSRZ3) on steam
2024-08-21 14:29:53,752 [DEBUG]    shift:213 - GET https://shift.gearboxsoftware.com/home?redirect_to=https%3A%2F%2Fshift.gearboxsoftware.com%2Fcode_redemptions%2Fnew 200
2024-08-21 14:29:53,947 [DEBUG]    shift:251 - GET https://shift.gearboxsoftware.com/home?redirect_to=https%3A%2F%2Fshift.gearboxsoftware.com%2Fentitlement_offer_codes 200 OK
2024-08-21 14:29:53,970 [DEBUG]    shift:259 - Could not find the form with class 'new_archway_code_redemption': <!DOCTYPE html>
[snip - see below]
2024-08-21 14:29:53,971 [DEBUG]    auto:51 - Status: Status.UNKNOWN
2024-08-21 14:29:53,971 [INFO]       <!DOCTYPE html>
[snip - see below]

Thank you for keeping this project alive, and let me know if any other information would help!

Full log

``` 2024-08-21 14:29:53,580 [INFO] Key #30/48 for bl2 on steam 2024-08-21 14:29:53,581 [INFO] Trying to redeem Zer0 Community Day Skin + 5 Golden Keys (53KBB-KXXRC-RZ66Z-WFJBB-WSRZ3) on steam 2024-08-21 14:29:53,752 [DEBUG] shift:213 - GET https://shift.gearboxsoftware.com/home?redirect_to=https%3A%2F%2Fshift.gearboxsoftware.com%2Fcode_redemptions%2Fnew 200 2024-08-21 14:29:53,947 [DEBUG] shift:251 - GET https://shift.gearboxsoftware.com/home?redirect_to=https%3A%2F%2Fshift.gearboxsoftware.com%2Fentitlement_offer_codes 200 OK 2024-08-21 14:29:53,970 [DEBUG] shift:259 - Could not find the form with class 'new_archway_code_redemption': SHiFT

© 2024 Gearbox. SHiFT is a registered trademark of Gearbox Enterprises, LLC. The Playstation Network logo is a registered trademark of Sony Computer Entertainment Inc.
The Xbox LIVE logo is a registered trademark of Microsoft Corporation. The Steam logo is a registered trademark of Valve Corporation. All rights reserved. Nintendo Switch is a trademark of Nintendo.

2024-08-21 14:29:53,971 [DEBUG] auto:51 - Status: Status.UNKNOWN 2024-08-21 14:29:53,971 [INFO] SHiFT

© 2024 Gearbox. SHiFT is a registered trademark of Gearbox Enterprises, LLC. The Playstation Network logo is a registered trademark of Sony Computer Entertainment Inc.
The Xbox LIVE logo is a registered trademark of Microsoft Corporation. The Steam logo is a registered trademark of Valve Corporation. All rights reserved. Nintendo Switch is a trademark of Nintendo.

2024-08-21 14:29:53,971 [INFO] Trying to prevent a 'too many requests'-block. ```

EDIT: Not sure what I did differently, but deleting each of the files in the data folder and running it again fixed this issue. Thank you for keeping this project alive!