package main
import (
"log"
"net/http"
"golang.org/x/net/html"
)
func main() {
// ch := make(chan int, 2)
// go In(ch)
// Out(ch)
//link, err := links.Extract("")
var hh *html.Node
var links []string
resp, err := http.Get("url")
if err != nil {
}
if hh.Type == html.ElementNode {
}
if str := hh.Data; str == "a" {
for _, a := range hh.Attr {
if a.Key == "href" {
link, err := resp.Request.URL.Parse(a.Val)
if err != nil {
log.Fatal(err)
}
links = append(links, link.String())
}
}
}
}
有疑问加站长微信联系(非本文作者)