Skip to content

Instantly share code, notes, and snippets.

@robsongomes
Created December 29, 2022 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robsongomes/c92316a99fb2d5a370b1b338d748b59b to your computer and use it in GitHub Desktop.
Save robsongomes/c92316a99fb2d5a370b1b338d748b59b to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
"github.com/PuerkitoBio/goquery"
)
// WEB Scraping com Go!
func main() {
// res, err := http.Get("https://www.google.com/")
// if err != nil {
// log.Fatal(err)
// }
// defer res.Body.Close()
// input := res.Body
input, _ := os.Open("index.html")
doc, _ := goquery.NewDocumentFromReader(input)
doc.Find(".foo").Each(func(i int, s *goquery.Selection) {
fmt.Println(s.Text())
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment