diff --git a/cmd/pipet/main.go b/cmd/pipet/main.go index d337137..d4b1024 100644 --- a/cmd/pipet/main.go +++ b/cmd/pipet/main.go @@ -125,6 +125,7 @@ func runPipet(c *cli.Context, specFile string) error { } log.Println("Generating output") + if jsonOutput { newValue = outputs.OutputJSON(pipet) } else if templateFile != "" { diff --git a/parsers/html.go b/parsers/html.go index d66a8ad..c2d5443 100644 --- a/parsers/html.go +++ b/parsers/html.go @@ -6,7 +6,7 @@ import ( "github.com/PuerkitoBio/goquery" ) -func ParseHTMLQueries(htmlData []byte, queries []string, nextPage string) (interface{}, string, error) { +func ParseHTMLQueries(htmlData []byte, queries []string, nextPage string) ([]interface{}, string, error) { result := []interface{}{} @@ -43,7 +43,13 @@ func ParseHTMLQueries(htmlData []byte, queries []string, nextPage string) (inter html = "" + html + "
" } value2, _, _ := ParseHTMLQueries([]byte(html), lines, "") - subresult = append(subresult, value2) + + if len(value2) == 1 { + subresult = append(subresult, value2[0]) + } else { + subresult = append(subresult, value2) + } + }) result = append(result, subresult)