Skip to content

Commit

Permalink
wrap table elements with a table because otherwise they disappear
Browse files Browse the repository at this point in the history
  • Loading branch information
bjesus committed Sep 12, 2024
1 parent ac254c7 commit ac6642f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion parsers/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func ParseHTMLQueries(htmlData []byte, queries []string, nextPage string) (inter
indentation := CalculateIndentation(line)
if len(queries) > i+1 && CalculateIndentation(queries[i+1]) > indentation {
// if line has children
elements := doc.Find(" " + line)
elements := doc.Find(line)

// get new lines
var lines []string
Expand All @@ -39,6 +39,9 @@ func ParseHTMLQueries(htmlData []byte, queries []string, nextPage string) (inter
elements.Each(func(subi int, subdoc *goquery.Selection) {
html, _ := goquery.OuterHtml(subdoc)

if strings.HasPrefix(html, "<tr") || strings.HasPrefix(html, "<td") {
html = "<table>" + html + "</table>"
}
value2, _, _ := ParseHTMLQueries([]byte(html), lines, "")
subresult = append(subresult, value2)
})
Expand Down

0 comments on commit ac6642f

Please sign in to comment.