Skip to content

Commit fb5be71

Browse files
committed
Add gathering URLs from main page
1 parent 0d77906 commit fb5be71

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Main.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"github.com/gocolly/colly"
6+
)
7+
8+
func main() {
9+
c := colly.NewCollector(colly.AllowedDomains("ideone.com"))
10+
11+
c.OnHTML("strong", func(htmlElement *colly.HTMLElement) {
12+
link := htmlElement.Attr("href")
13+
fmt.Printf("Found link: %q -> %s\n", htmlElement.Text, link)
14+
})
15+
16+
c.Visit("https://ideone.com/recent")
17+
18+
}

0 commit comments

Comments
 (0)