HowLongToBeat-PythonAPI icon indicating copy to clipboard operation
HowLongToBeat-PythonAPI copied to clipboard

August 2024 no longer returning data from HowLongToBeat.com

Open ScrappyCocco opened this issue 1 year ago • 3 comments

Discussed in https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/discussions/24

Originally posted by yipidee August 2, 2024 I've been using howlongtobeatpy in a script with no problems for some time now, but suddenly it has started returning "None" for any search term. HowLongToBeat is up and running, has the API been broken by some change?

ScrappyCocco avatar Aug 02 '24 15:08 ScrappyCocco

Hello and thank you for the Issue @yipidee

The library is (at least temporarily) fixed on howlongtobeatpy 1.0.6

It looks like the search url changed from "api/search" to "api/search" + "/4b4cbe570602c88660f7df8ea0cb6b6e"

This code looks like a hash of some kind but I investigated just a little and it doesn't looks like it's user-generated I tried to open the website from a different pc in a completely different network (different IP) and it was still that one So maybe it's a random-access token and they're going to change it every X-time? In that case we need to figure out where is it received on the client and to gather that too for the api to work correctly

This need to be checked so I'm going to leave the issue on hold for a while

ScrappyCocco avatar Aug 02 '24 16:08 ScrappyCocco

Issue fixed in 1.0.6

yipidee avatar Aug 02 '24 23:08 yipidee

Had the same issue today and 1.0.6 fixed it right away. Looks good! Thank you.

cpresse avatar Aug 04 '24 19:08 cpresse

Looks like it got updated again, the search guid is now "ac8bb4dd1834c9056f6f6a0294fdb1b4"

tlt21 avatar Aug 07 '24 04:08 tlt21

Ok so it changes every now and then and it can't be hardcoded like that, it must be read somewhere from the website like the browser does I am not available to update it now, I'll have a look at it at the end of the month, I am sorry

ScrappyCocco avatar Aug 07 '24 07:08 ScrappyCocco

Also that /search/key looks like to be generated or loaded inside a js like https://howlongtobeat.com/_next/static/chunks/pages/_app-dbc6a57c887f99a6.js that doesn't seems stable url to read it, so a solution is not immediate either

ScrappyCocco avatar Aug 07 '24 07:08 ScrappyCocco

I'm doing some tests in this branch https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/tree/FetchApiKey (PR #25) reading the api key from the website and it looks like it works fine, could publish a new version soon

ScrappyCocco avatar Aug 07 '24 08:08 ScrappyCocco

All tests are green, version 1.0.7 fetch the api key from the website so it could be a bit slower but should work fine for a longer time (hopefully)

I used a new method to publish the package on pypi so if there are problems please let me know

https://pypi.org/project/howlongtobeatpy/1.0.7/

ScrappyCocco avatar Aug 07 '24 08:08 ScrappyCocco