tweak to get link href and img src

This commit is contained in:
Stephen McQuay 2016-11-25 23:34:07 -08:00
parent 546ddeff18
commit b2df3da864
No known key found for this signature in database
GPG Key ID: 1ABF428F71BAFC3D

View File

@ -24,9 +24,10 @@ func URLs(url string) []Link {
paths := []Link{}
var f func(*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 {
if a.Key == "href" {
switch a.Key {
case "href", "src":
paths = append(paths, Link{From: url, To: a.Val})
break
}