able to list products
This commit is contained in:
@ -0,0 +1,20 @@
|
||||
package sravni
|
||||
|
||||
import "golang.org/x/net/html"
|
||||
|
||||
func findNode(parent *html.Node, eq func(*html.Node) (found, deeper bool)) *html.Node {
|
||||
for child := parent.FirstChild; child != nil; child = child.NextSibling {
|
||||
found, deeper := eq(child)
|
||||
if found {
|
||||
return child
|
||||
}
|
||||
if deeper {
|
||||
deeperChild := findNode(child, eq)
|
||||
if deeperChild != nil {
|
||||
return deeperChild
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user