use io.Reader when parsing urls
This commit is contained in:
+10
-1
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"mcquay.me/spider"
|
||||
@@ -14,7 +15,15 @@ func main() {
|
||||
fmt.Fprintf(os.Stderr, "%s\n", usage)
|
||||
os.Exit(1)
|
||||
}
|
||||
for _, l := range spider.URLs(os.Args[1]) {
|
||||
resp, err := http.Get(os.Args[1])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
links, err := spider.URLs(resp.Body)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, l := range links {
|
||||
fmt.Println(l)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user