|
@@ -14,6 +14,25 @@ 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://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.cafe24h.com.vn/ca-phe-truyen-thong/"
|
|
url := "https://www.cafe24h.com.vn/ca-phe-truyen-thong/"
|
|
|
|
+ url = "https://ssline.kr/shop/view.php?index_no=36357" //cafe24
|
|
|
|
+ // url = "https://koskomro.com" //cafe24
|
|
|
|
+ // url := "https://bt-beloria-1.myshopify.com/collections/women-collection/products/sweater-classical-tshirt"
|
|
|
|
+ // url := "https://seoulknit.com/shop/v-neck-summer-pullover/"
|
|
|
|
+ // url = "https://www.elcanto.co.kr" //MakeShop
|
|
|
|
+ // url = "https://www.ippngirl.co.kr" //MakeShop
|
|
|
|
+ // url = "https://bt-beloria-1.myshopify.com" //shopify
|
|
|
|
+ // url = "https://lachinatakorea.com" //Godomall
|
|
|
|
+ // url = "https://sf-fd.com" //Godomall
|
|
|
|
+ // url = "https://www.vanillagift.com" //Magento
|
|
|
|
+ // url = "https://taiwan.coach.com" //Magento
|
|
|
|
+ // url = "http://mas1.magikthemes.com" //Magento
|
|
|
|
+ // url = "https://aladinmarket.co.kr" //young Cart
|
|
|
|
+ // url = "http://damoagift.com" //young Cart
|
|
|
|
+ // url = "https://p2u.daboryhost.com" /DaboryShop
|
|
|
|
+ // url = "https://seoulknit.com" //Woocommerce
|
|
|
|
+ // url = "http://webhost.dabory.com/" /Woocommerce
|
|
|
|
+ // url = "https://addand.kr" // WooCommerce
|
|
|
|
+ // url := "https://droppii.net.vn/cnd-ginseng-gold"
|
|
// Send an HTTP GET request to the URL
|
|
// Send an HTTP GET request to the URL
|
|
response, err := http.Get(url)
|
|
response, err := http.Get(url)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -27,18 +46,18 @@ func main() {
|
|
}
|
|
}
|
|
|
|
|
|
// These will the value of PDP parsing structures
|
|
// These will the value of PDP parsing structures
|
|
- cItemName := ".section-header>.section-title"
|
|
|
|
- cShortDesc := ".content-detail.col-md-8 p"
|
|
|
|
|
|
+ cItemName := ".tit"
|
|
|
|
+ cShortDesc := ".vi_tab:last"
|
|
cItemCategory := ".container>.section-header>.section-title"
|
|
cItemCategory := ".container>.section-header>.section-title"
|
|
- cItemTags := ".tagged_as"
|
|
|
|
- cItemImages := ".product-img a"
|
|
|
|
- cItemTextDesc := ".content-detail.col-md-8"
|
|
|
|
|
|
+ cItemTags := ".vi_tab"
|
|
|
|
+ cItemImages := ".vi_info .simg_li img"
|
|
|
|
+ cItemTextDesc := ".mart15>.__se_tbl_ext"
|
|
// // cItemOptions := "select#rating option"
|
|
// // cItemOptions := "select#rating option"
|
|
- // cItemPrice := ".summary>.price .woocommerce-Price-amount.amount"
|
|
|
|
- cEmail := "footer"
|
|
|
|
- cRating := ".star-rating .rating"
|
|
|
|
- cAuthor := ".product-brand a"
|
|
|
|
- cVideo := "iframe"
|
|
|
|
|
|
+ cItemPrice := ".price_bx .price"
|
|
|
|
+ // cEmail := "footer"
|
|
|
|
+ // cRating := ".star-rating .rating"
|
|
|
|
+ // cAuthor := ".product-brand a"
|
|
|
|
+ // cVideo := "iframe"
|
|
|
|
|
|
// Use the Find method to select elements that match the css selector
|
|
// Use the Find method to select elements that match the css selector
|
|
// doc.Find(cItemName).Each(func(index int, element *goquery.Selection) {
|
|
// doc.Find(cItemName).Each(func(index int, element *goquery.Selection) {
|
|
@@ -47,35 +66,55 @@ func main() {
|
|
// fmt.Printf("Text associated with %s: %s\n", cItemName, text)
|
|
// 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("ItemName: ", doc.Find(cItemName).First().Text())
|
|
fmt.Println("ShortDesc: ", doc.Find(cShortDesc).First().Text())
|
|
fmt.Println("ShortDesc: ", doc.Find(cShortDesc).First().Text())
|
|
fmt.Println("ItemCategory: ", doc.Find(cItemCategory).First().Text())
|
|
fmt.Println("ItemCategory: ", doc.Find(cItemCategory).First().Text())
|
|
fmt.Println("ItemTags: ", doc.Find(cItemTags).First().Text())
|
|
fmt.Println("ItemTags: ", doc.Find(cItemTags).First().Text())
|
|
|
|
|
|
fmt.Println("TextDesc: ", doc.Find(cItemTextDesc).First().Text())
|
|
fmt.Println("TextDesc: ", doc.Find(cItemTextDesc).First().Text())
|
|
- // 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())
|
|
|
|
|
|
+ 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")
|
|
|
|
- fmt.Println(v, " : ", s.AttrOr("content", ""))
|
|
|
|
- })
|
|
|
|
|
|
+ // doc.Find("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")
|
|
|
|
- fmt.Println("====================")
|
|
|
|
- fmt.Println("AuthorName: ", element.Text())
|
|
|
|
- fmt.Printf("AuthorLink: %s\n", link)
|
|
|
|
- })
|
|
|
|
|
|
+ // doc.Find(cAuthor).Each(func(index int, element *goquery.Selection) {
|
|
|
|
+ // link, _ := element.Attr("href")
|
|
|
|
+ // fmt.Println("====================")
|
|
|
|
+ // fmt.Println("AuthorName: ", element.Text())
|
|
|
|
+ // fmt.Printf("AuthorLink: %s\n", link)
|
|
|
|
+ // })
|
|
|
|
|
|
- vdos := []string{}
|
|
|
|
- doc.Find(cVideo).Each(func(index int, element *goquery.Selection) {
|
|
|
|
- embed, _ := element.Attr("src")
|
|
|
|
- vdos = append(vdos, embed)
|
|
|
|
- })
|
|
|
|
- fmt.Printf("ItemVideos: %s\n", vdos)
|
|
|
|
|
|
+ // vdos := []string{}
|
|
|
|
+ // doc.Find(cVideo).Each(func(index int, element *goquery.Selection) {
|
|
|
|
+ // embed, _ := element.Attr("src")
|
|
|
|
+ // vdos = append(vdos, embed)
|
|
|
|
+ // })
|
|
|
|
+ // fmt.Printf("ItemVideos: %s\n", vdos)
|
|
|
|
|
|
imgs := []string{}
|
|
imgs := []string{}
|
|
doc.Find(cItemImages).Each(func(index int, element *goquery.Selection) {
|
|
doc.Find(cItemImages).Each(func(index int, element *goquery.Selection) {
|