Created
December 29, 2022 13:16
-
-
Save robsongomes/c92316a99fb2d5a370b1b338d748b59b to your computer and use it in GitHub Desktop.
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" | |
"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