TibiaData/tibiadata-api-go

Issue: TibiaGuildsOverviewV3 description line break

tobiasehlert opened this issue · 2 comments

In TibiaGuildsOverviewV3, the description of a guild is not correct.
Since we run a removal of line breaks, but when commenting out line shown below, the whole endpoint fails.

GuildsDivHTML = TibiadataHTMLRemoveLinebreaksV3(GuildsDivHTML)

Temporarily fixed endpoint with commit 5179ba9.

Example URLs to compare (search for guild Elysium):
https://dev.tibiadata.com/v3/guilds/world/Vunira
https://dev.tibiadata.com/v3/guilds/guild/Elysium

Found the cause of this issue. There are several line breaks in the HTML structure, not only in the guild description.
So running the line 65 (TibiadataHTMLRemoveLineBreaksV3 function), will make the regex successfully match.
But commenting out line 65 will break the regex.
We need to handle the line break removal only for the HTML structure and not for description text and also update the regex since (.*) argument captor will not match for line breaks.

In my opinion we should be using pure goquery and avoid using manual regex as much as possible.

Found the cause of this issue. There are several line breaks in the HTML structure, not only in the guild description. So running the line 65 (TibiadataHTMLRemoveLineBreaksV3 function), will make the regex successfully match. But commenting out line 65 will break the regex. We need to handle the line break removal only for the HTML structure and not for description text and also update the regex since (.*) argument captor will not match for line breaks.

In my opinion we should be using pure goquery and avoid using manual regex as much as possible.

Thanks for looking into this issue @JorgeMag96!

And yes, it's not a bad idea to do more with goquery. v1 and v2 relied mostly on regex so I reused most of those to speed up building v3 and not to reinvent the wheel that much.
But it looks like goquery is more efficient based on @kamilon, so we'll look into refactoring more of the added things, to increase performance and decrease utilization of resources.