hocjooker@gmail.com 1 jaar geleden
bovenliggende
commit
01eb0f2a3b
1 gewijzigde bestanden met toevoegingen van 14 en 0 verwijderingen
  1. 14 0
      main.go

+ 14 - 0
main.go

@@ -56,6 +56,20 @@ func main() {
 	fmt.Println("ItemPice: ", doc.Find(cItemPrice).First().Text())
 	fmt.Println("Email: ", findEmail(doc.Find(cEmail).First().Text(), ""))
 	fmt.Println("Rating : ", doc.Find(cRating).First().Text())
+
+	doc.Find("link ~ meta").Each(func(i int, s *goquery.Selection) {
+		v, _ := s.Attr("property")
+		if v == "og:description" {
+			fmt.Println("og:description : ", s.AttrOr("content", ""))
+		} else if v == "og:title" {
+			fmt.Println("og:title : ", s.AttrOr("content", ""))
+		} else if v == "og:image" {
+			fmt.Println("og:image : ", s.AttrOr("content", ""))
+		} else if v == "product:price:currency" {
+			fmt.Println("currency : ", s.AttrOr("content", ""))
+		}
+	})
+
 	fmt.Println("Author : ")
 	doc.Find(cAuthor).Each(func(index int, element *goquery.Selection) {
 		link, _ := element.Attr("href")