Last active
June 10, 2019 16:15
-
-
Save mottet-dev/6c77b80476f5df50b7b02259d6da221d to your computer and use it in GitHub Desktop.
OnHTML - Go Colly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/gocolly/colly" | |
) | |
func main() { | |
c := colly.NewCollector() | |
c.OnRequest(func(r *colly.Request) { | |
fmt.Println("Visiting", r.URL) | |
}) | |
c.OnHTML("div.s-result-list.s-search-results.sg-row", func(e *colly.HTMLElement) { | |
// ... | |
}) | |
c.Visit("https://www.amazon.com/s?k=nintendo+switch&ref=nb_sb_noss_1") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment