File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import (
1616// Parser is an HTML parser that extracts microdata
1717type Parser struct {
1818 r io.Reader
19- Microdata map [string ]interface {}
19+ Microdata [] map [string ]interface {}
2020 baseURL * url.URL
2121}
2222
@@ -34,9 +34,8 @@ func (p *Parser) JSON() ([]byte, error) {
3434// baseURL is the base URL for resolving relative URLs
3535func NewParser (r io.Reader , baseURL * url.URL ) * Parser {
3636 return & Parser {
37- r : r ,
38- Microdata : nil ,
39- baseURL : baseURL ,
37+ r : r ,
38+ baseURL : baseURL ,
4039 }
4140}
4241
@@ -82,10 +81,11 @@ func (p *Parser) Parse() error {
8281 }
8382
8483 // Parsing DOM with microdata to the object
85- p .Microdata = make (map [string ]interface {})
8684 selector = dom .ChildrenFiltered ("*" )
8785 selector .Each (func (i int , s * goquery.Selection ) {
88- p .extractItem (s , p .Microdata )
86+ item := make (map [string ]interface {})
87+ p .extractItem (s , item )
88+ p .Microdata = append (p .Microdata , item )
8989 })
9090
9191 return nil
You can’t perform that action at this time.
0 commit comments