Smart123s / ItchClaim

Automatically claim free games from itch.io
https://itchclaim.tmbpeter.com
MIT License
52 stars 1 forks source link

invalid game / invalid user #6

Closed Michounet closed 10 months ago

Michounet commented 10 months ago

Thanks a lot for this script! I've tried it and it worked like a charm. I have encountered a few errors when claiming games. The most obvious one is "you must buy this game to download", which means that the sale has ended. But for other items I have encountered two types of errors (invalid game and invalid user) that didn't make much sense. A few examples:

ERROR: Failed to claim game ROGUE A.I (testing map) (url: https://polygon-sphere.itch.io/rogue-ai) invalid game

Page is redirected to https://polygon-sphere.itch.io/rogueai (not rogue-ai) and I could claim the game manually.

ERROR: Failed to claim game ZigZag (url: https://speedrungames.itch.io/zigzag) invalid user

Game page is gone (even the developer's "hub" is gone, which should explain the "invalid (itch.io) user" error)

ERROR: Failed to claim game Pixel Vegetables - Buried Pack (url: https://**octo-bit**.itch.io/pixel-vegetables-1) invalid user

Page URL (developer's username) has changed to https://**octopyte**.itch.io/pixel-vegetables-1 and is not free anymore.

Same goes for

ERROR: Failed to claim game HP BAR ASSETS PACK (url: https://**vronti**.itch.io/hp-bar-assets-pack) invalid user

Link redirects to https://**daions-studio**.itch.io/hp-bar-assets-pack, although the game is not claimable and can only be downloaded.

Would it be possible to detect when a link is redirected (game or username change) and act accordingly, following the redirection and claiming the product? It would also be nice if that information could be sent back (relayed) to the online database so it is updated ASAP (ideally before the sale ends). Of course, that would be totally optional and it should not be active by default. However, that might be a bit overkill since I'm guessing these changes would be caught in the next database update, wouldn't they?

Smart123s commented 10 months ago

I've pushed an update (https://github.com/Smart123s/ItchClaim/commit/d744c0fc4878e1da69fa31176649cc4695af8ced), should be live on pip & docker within a few minutes. Could you please check if it fixes your issue? Don't forget to manually update the script to version 1.3.3 before trying this out (itchclaim --version).

Michounet commented 10 months ago

Before upgrading:

ERROR: Failed to claim game HP BAR ASSETS PACK (url: https://vronti.itch.io/hp-bar-assets-pack) invalid user ERROR: Failed to claim game top-down character Template asset-pack (url: https://vronti.itch.io/free-top-down-character-template) invalid user ERROR: Failed to claim game Pixel Vegetables - Buried Pack (url: https://octo-bit.itch.io/pixel-vegetables-1) invalid user ERROR: Failed to claim game Pixel Vegetables - Overground Pack (url: https://octo-bit.itch.io/pixel-vegetables-2) invalid user ERROR: Failed to claim game Pixel Vegetables - Tall Pack (url: https://octo-bit.itch.io/pixel-vegetables-3) invalid user [...]

After upgrading to version 1.3.3:

WARN: URL of game HP BAR ASSETS PACK has changed to https://daions-studio.itch.io/hp-bar-assets-pack Game HP BAR ASSETS PACK is not claimable (url: https://daions-studio.itch.io/hp-bar-assets-pack) WARN: URL of game top-down character Template asset-pack has changed to https://daions-studio.itch.io/free-top-down-character-template WARN: URL of game Pixel Vegetables - Buried Pack has changed to https://octopyte.itch.io/pixel-vegetables-1 ERROR: Failed to claim game Pixel Vegetables - Buried Pack (url: https://octopyte.itch.io/pixel-vegetables-1) you must buy this game to download WARN: URL of game Pixel Vegetables - Overground Pack has changed to https://octopyte.itch.io/pixel-vegetables-2 ERROR: Failed to claim game Pixel Vegetables - Overground Pack (url: https://octopyte.itch.io/pixel-vegetables-2) you must buy this game to download WARN: URL of game Pixel Vegetables - Tall Pack has changed to https://octopyte.itch.io/pixel-vegetables-3 ERROR: Failed to claim game Pixel Vegetables - Tall Pack (url: https://octopyte.itch.io/pixel-vegetables-3) you must buy this game to download [...]

So yes, it now detects if there is a redirection and it tries to process the redirected URL. Unfortunately these particular sales have already ended (except HP BAR ASSETS PACK which is not claimable) but it should work from now on, I'll keep an eye on future sales to see if the WARN/redirection fix works.

Thanks a lot for checking this issue and for updating the script so quickly!

Smart123s commented 10 months ago

As I have wanted to describe it earlier, the script only checks the sales once, and if it's found, stores it, and never touches it again. The reason to that is simple: saving resources. There could be a job added to clean up modified sales every once in a while, but that would take a bit longer time, so that'll be a project for later. The script reports back idea is great, but not really possible with the current setup on GitHub pages, as it's only capable of sending out files. And also, if the script can send requests back, then it's a lot easier for malicious users to automate bot requests pretending to be the script, any issue I1d prefer not to deal with in a hobby project this small.

Michounet commented 10 months ago

I totally agree with you, that's why I said in my first post that implementing those features (script reporting back to the server) might have been a bit overkill. As you suggest, one of the things that immediately crossed my mind is that it could be exploited to send incorrect reports back to the server, so those checks and fixes would have needed some kind of human revision or a very good implementation to avoid abusing it.

Once the issue is fixed on the user side by following the redirection and claiming (if possible) the product it should be enough of a solution and anything on top of that would be a bonus (which might introduce more headaches than benefits).

Again, thanks a lot for updating the script and fixing this (small) issue. And, of course, thank you for creating the script in the first place!