Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data not retrieved for some games with special characters #19

Open
syrnyk opened this issue Dec 29, 2024 · 4 comments
Open

Data not retrieved for some games with special characters #19

syrnyk opened this issue Dec 29, 2024 · 4 comments

Comments

@syrnyk
Copy link

syrnyk commented Dec 29, 2024

Some games like "Nier Automata" or "Legacy of Kain remastered" are not retrieved properly from HLTB.
In theses specific cases, they contain " ™ " in the Steam name. From what I briefly saw in the code, a filter is applied on the game name received from HLBT (normalize() method) but not on the game name coming from Steam that is used for the HLBT query.
There might be two points of failure here:

  • not filtering out special characters in the game name coming from Steam before sending it to HLBT (if we search for "NieR:Automata™" with the special char on the website, there are no result, so they should be filtered out before the query to be sure a match is found)
  • but maybe that won't be enough since after receiving the response, the filtered game name from HLBT is compared with the unfiltered game name from Steam. So simply applying the filter for special chars before the query probably won't work on its own
@morwy
Copy link

morwy commented Dec 30, 2024

As far as I can see in the code, the game name received from Steam is also normalized at line 48 in file LibraryApp.tsx. I have met this issue previously too - but not only when game name contained " ™ " or some special characters but also with pretty normal names, e.g. "WORLD END ECONOMiCA episode.01".

@kergoth
Copy link

kergoth commented Dec 30, 2024

Removing the trademark symbol seems like an obvious addition worth including, but I think ideally there would be an interface to select which game to match from the IGDB search results, like there is in PlayNite, for example.

@morwy
Copy link

morwy commented Dec 30, 2024

It looks like the problem was in normalize() function from utils.ts. In particular .replace(/[^a-zA-Z0-9\-\/\s]/g, '') - it replaces all non digit and non character symbols with none. Thus, "NieR:Automata™" becomes "nierautomata".

I somewhat fixed it in morwy#7.

Please note that there are still some games that do not show HLTB stats. It happens because they have a little bit different names in HLTB and Steam (e.g. "Hyperdimension Neptunia Re;Birth1" in Steam vs "Hyperdimension Neptunia Re;Birth 1" in HLTB).

@syrnyk
Copy link
Author

syrnyk commented Dec 30, 2024

Ah I see, thanks for the fix, works well on some games. I saw the issue you mentioned for "Legacy of Kain™ Soul Reaver 1&2 Remastered". "TM" and "&" are removed, but the issue is that the chars are replaced by an empty string. No big deal for the "TM" since it's followed by a space, but the "1&2" becomes "12" in the HLTB search, which gives no results unsurprisingly.

For these cases, do you see any possible regression if you replace special chars by a space instead of an empty string in the search? Added spaces don't seem to matter in the HLTB search, even in place of a special char, but missing spaces can break the search.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants