added archive, megamillions, and powerball site logic
This commit is contained in:
32
nodes.go
Normal file
32
nodes.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package extractor
|
||||
|
||||
type Nodes []Node
|
||||
|
||||
func (n Nodes) Select(selector string) Nodes {
|
||||
var res Nodes
|
||||
|
||||
for _, node := range n {
|
||||
res = append(res, node.Select(selector)...)
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
func (d Nodes) First() Node {
|
||||
return d[0]
|
||||
}
|
||||
|
||||
func (d Nodes) ExtractText() ([]string, error) {
|
||||
var res []string
|
||||
|
||||
for _, doc := range d {
|
||||
text, err := doc.Text()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = append(res, text)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
Reference in New Issue
Block a user