-
Notifications
You must be signed in to change notification settings - Fork 0
/
collectlinks_ex2.go
64 lines (58 loc) · 1.39 KB
/
collectlinks_ex2.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
import (
"fmt"
"github.com/jackdanger/collectlinks"
"net/http"
)
func download(url string) {
resp, _ := http.Get(url)
links := collectlinks.All(resp.Body)
for _, link := range links {
fmt.Println(link)
}
}
func main() {
url := "https://www.freecodecamp.org/"
download (url)
}
/* result:
$ go run collectlinks_ex2.go
/learn
/news
/forum
/signin
/donate
/news/about/
https://www.linkedin.com/school/free-code-camp/people/
https://github.com/freeCodeCamp/
/news/shop/
/news/support/
/news/sponsors/
/news/academic-honesty-policy/
/news/code-of-conduct/
/news/privacy-policy/
/news/terms-of-service/
/news/copyright-policy/
/news/2019-web-developer-roadmap/
/news/best-python-tutorial/
/news/understanding-flexbox-everything-you-need-to-know-b4013d4dc9af/
/news/best-javascript-tutorial/
/news/python-example/
/news/best-html-html5-tutorial/
/news/linux-command-line-bash-tutorial/
/news/javascript-example/
/news/best-git-tutorial/
/news/best-react-javascript-tutorial/
/news/best-java-8-tutorial/
/news/the-best-linux-tutorials/
/news/best-css-and-css3-tutorial/
/news/the-best-jquery-examples/
/news/best-sql-database-tutorial/
/news/css-example-css3/
/news/react-examples-reactjs/
/news/best-angular-tutorial-angularjs/
/news/the-best-bootstrap-examples/
/news/the-ultimate-guide-to-ssh-setting-up-ssh-keys/
/news/best-wordpress-tutorial/
/news/the-best-php-examples/
*/