hocjooker@gmail.com 1 år sedan
förälder
incheckning
ee2e779e50
1 ändrade filer med 27 tillägg och 5 borttagningar
  1. 27 5
      main.go

+ 27 - 5
main.go

@@ -14,6 +14,13 @@ func main() {
 	// url := "https://addand.kr/shop/new-%ed%95%9c-%ea%b6%8c%ec%9c%bc%eb%a1%9c-%eb%81%9d%eb%82%98%eb%8a%94-%eb%85%b8%ec%85%98/"
 
 	url := "https://www.fredperry.com/men/sharp/glitch-chequerboard-cardigan-k6512-q41.html"
+	url = "https://taiwan.coach.com/cm538-lhslv.html" //Magento
+
+	// url= "https://www.elcanto.co.kr" //MakeShop
+	// url= "https://www.ippngirl.co.kr" //MakeShop
+	// url= "https://lachinatakorea.com" //Godomall
+	// url= "https://sf-fd.com" //Godomall
+	// url= "https://p2u.daboryhost.com" /DaboryShop
 	// Send an HTTP GET request to the URL
 	response, err := http.Get(url)
 	if err != nil {
@@ -46,6 +53,26 @@ func main() {
 	// 	fmt.Printf("Text associated with %s: %s\n", cItemName, text)
 	// })
 
+	doc.Find("meta").Each(func(i int, s *goquery.Selection) {
+		v, _ := s.Attr("property")
+		if v == "author" {
+			fmt.Println("Author : ", s.AttrOr("content", ""))
+		}
+
+		if v == "og:title" {
+			fmt.Println("ItemName: ", s.AttrOr("content", ""))
+		}
+
+		if v == "og:description" {
+			fmt.Println("TextDesc: ", s.AttrOr("content", ""))
+		}
+
+		if v == "og:image" {
+			fmt.Println("Images: ", s.AttrOr("content", ""))
+		}
+
+		// fmt.Println()
+	})
 	fmt.Println("ItemName: ", doc.Find(cItemName).First().Text())
 	fmt.Println("ShortDesc: ", doc.Find(cShortDesc).First().Text())
 	fmt.Println("ItemCategory: ", doc.Find(cItemCategory).First().Text())
@@ -56,11 +83,6 @@ func main() {
 	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")
-		fmt.Println(v, "  : ", s.AttrOr("content", ""))
-	})
-
 	fmt.Println("Author : ")
 	doc.Find(cAuthor).Each(func(index int, element *goquery.Selection) {
 		link, _ := element.Attr("href")