-
Notifications
You must be signed in to change notification settings - Fork 7
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
[REQUEST] Consider separating the fetching of game details from search. #41
Comments
You can provide a PR with your change so we can check it out and discuss it! |
Also at the time years ago I did that the search by id is actually searching by name to reuse the same parser, how do you search directly from id in your api? |
Not my code, but the JS version of this library parsed the HTML on the detail pages (e.g. https://howlongtobeat.com/game/5037), which never changes. Their implementation is here: ckatzorke/howlongtobeat | howlongtobeat.ts#L105-L113. That way, the packages does 2 things:
As written, you lose both pieces of functionality when the search breaks, since your implementations are coupled together. |
Parsing the HTML requires maintaining another parser which may break virtually anytime and doesn't seems a viable or better solution to me |
That's true, but the whole thing already breaks all the time because of changes on the HLTB side. Isn't it better for search to break the same amount, but other functionality to break less?
the HTML on the game-specific pages also hasn't changed in years. So it's less of "maintaining a second parser" and more of "write a second parser once" (which I'm happy to submit a PR for). It would be the same amount of maintenance, but you'd go from "everything breaks" to "some functionality breaks", which seems like a worthwhile improvement to me. 🤷♂️ |
Right now I don't like the idea of having and maintaining a second parser: at the time the HTML parser had many problems and was not very efficient and easy to maintain and write, and yes it required changes. I'm more into having a system that recognize the search call as for example #45 and hopefully other similar systems in the future, if you find a good solution to make a good parser feel free to open a PR for it and we can discuss, but I don't like the overall idea. |
Describe what change or improvement would you like
It seems like the search url is the one HLTB keeps changing. While your HTTP parsing code means you only have to worry about the one page / url, it also means that fetching game details starts to fail as soon as search is broken.
Given that they don't often change the details page, It might be worth parsing it directly in the
search_from_id
methods so it's more stable (even when search by name periodically breaks).Happy to help out with this (or any of the issues I've been opening; sorry for the deluge)!
The text was updated successfully, but these errors were encountered: