In [1]:
import "github.com/gocolly/colly"


gomacro compiled without support to load plugins - requires Go 1.8+ and Linux - cannot import packages at runtime

In [2]:
c := colly.NewCollector()


repl.go:1:6: undefined identifier: colly

In [3]:
c.OnRequest(func(r *colly.Request) {
    fmt.Println("Visiting", r.URL)
})

c.OnError(func(_ *colly.Response, err error) {
    log.Println("Something went wrong:", err)
})

c.OnResponse(func(r *colly.Response) {
    fmt.Println("Visited", r.URL)
})

c.OnHTML("a[href]", func(e *colly.HTMLElement) {
    e.Request.Visit(e.Attr("href"))
})

c.OnHTML("tr td:nth-of-type(1)", func(e *colly.HTMLElement) {
    fmt.Println("First column of a table row:", e.Text)
})

c.OnScraped(func(r *colly.Response) {
    fmt.Println("Finished", r.URL)
})


repl.go:1:1: undefined identifier: c

In [5]:
c.Visit('https://mylesb.ca/')


repl.go:1:9: illegal rune literal

In [ ]: