Size: a a a
РД
Н
Н
Ee
S
S
package main
import (
"fmt"
"io/ioutil"
"log"
"strings"
"golang.org/x/net/html"
)
func main() {
dat, err := ioutil.ReadFile("output.html")
doc, err := html.Parse(strings.NewReader(string(dat)))
if err != nil {
log.Fatal(err)
}
var f func(*html.Node)
f = func(n *html.Node) {
if n.Type == html.ElementNode && n.Data == "script" {
for _, a := range n.Attr {
if a.Key == "type" && a.Val == "application/ld+json" {
fmt.Print("Coords for ship finded!")
fmt.Print(n.LastChild.Data)
break
}
}
}
for c := n.FirstChild; c != nil; c = c.NextSibling {
f(c)
}
}
f(doc)
}
N
N
S
РД
package main
import (
"fmt"
"io/ioutil"
"log"
"strings"
"golang.org/x/net/html"
)
func main() {
dat, err := ioutil.ReadFile("output.html")
doc, err := html.Parse(strings.NewReader(string(dat)))
if err != nil {
log.Fatal(err)
}
var f func(*html.Node)
f = func(n *html.Node) {
if n.Type == html.ElementNode && n.Data == "script" {
for _, a := range n.Attr {
if a.Key == "type" && a.Val == "application/ld+json" {
fmt.Print("Coords for ship finded!")
fmt.Print(n.LastChild.Data)
break
}
}
}
for c := n.FirstChild; c != nil; c = c.NextSibling {
f(c)
}
}
f(doc)
}
N
N
N