tweak to get link href and img src
This commit is contained in:
parent
546ddeff18
commit
b2df3da864
@ -24,9 +24,10 @@ func URLs(url string) []Link {
|
|||||||
paths := []Link{}
|
paths := []Link{}
|
||||||
var f func(*html.Node)
|
var f func(*html.Node)
|
||||||
f = func(n *html.Node) {
|
f = func(n *html.Node) {
|
||||||
if n.Type == html.ElementNode && n.Data == "a" {
|
if n.Type == html.ElementNode {
|
||||||
for _, a := range n.Attr {
|
for _, a := range n.Attr {
|
||||||
if a.Key == "href" {
|
switch a.Key {
|
||||||
|
case "href", "src":
|
||||||
paths = append(paths, Link{From: url, To: a.Val})
|
paths = append(paths, Link{From: url, To: a.Val})
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user