Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/TibiaGuildsGuildV3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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", "<br/><br/>\n", "")
log.Println(GuildDescription)

// Abort loop and continue wiht next section
if strings.Contains(line, "<br/><br/>") {
guild = GuildDescription
GuildDescription = TibiaDataSanitizeEscapedString(GuildDescription)
GuildDescription = strings.TrimSpace(TibiaDataSanitizeEscapedString(GuildDescription))
GuildDescriptionFinished = true
}

Expand Down
2 changes: 1 addition & 1 deletion src/TibiaGuildsOverviewV3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down