diff --git a/src/TibiaGuildsGuildV3.go b/src/TibiaGuildsGuildV3.go index 2ed30b47..efea07ba 100644 --- a/src/TibiaGuildsGuildV3.go +++ b/src/TibiaGuildsGuildV3.go @@ -118,21 +118,23 @@ func TibiaGuildsGuildV3(c *gin.Context) { log.Fatal(err) } - var GuildDescriptionFinished bool + var GuildNameDetected, GuildDescriptionFinished bool for _, line := range strings.Split(strings.TrimSuffix(InnerTableContainerTMPB, "\n"), "\n") { - log.Println(line) + // setting guild name based on html + if !GuildNameDetected { + guild = strings.TrimSpace(RemoveHtmlTag(line)) + GuildNameDetected = true + } // Guild information if !GuildDescriptionFinished { // First line is the description.. GuildDescription += strings.ReplaceAll(line+"\n", "

\n", "") - log.Println(GuildDescription) // Abort loop and continue wiht next section if strings.Contains(line, "

") { - guild = GuildDescription - GuildDescription = TibiaDataSanitizeEscapedString(GuildDescription) + GuildDescription = strings.TrimSpace(TibiaDataSanitizeEscapedString(GuildDescription)) GuildDescriptionFinished = true } diff --git a/src/TibiaGuildsOverviewV3.go b/src/TibiaGuildsOverviewV3.go index cf6e4fd5..e12fb846 100644 --- a/src/TibiaGuildsOverviewV3.go +++ b/src/TibiaGuildsOverviewV3.go @@ -85,7 +85,7 @@ func TibiaGuildsOverviewV3(c *gin.Context) { // Check if there's a description to fetch. if nameAndDescriptionNode.FirstChild.NextSibling != nil && nameAndDescriptionNode.FirstChild.NextSibling.NextSibling != nil { - description = nameAndDescriptionNode.FirstChild.NextSibling.NextSibling.Data + description = strings.TrimSpace(nameAndDescriptionNode.FirstChild.NextSibling.NextSibling.Data) } OneGuild := Guild{