fix(steam): price text extraction

fixes #4
This commit is contained in:
Felipe Martin Garcia 2022-08-07 12:34:10 +02:00
parent d98546b445
commit ae380468e4
Signed by: fmartingr
GPG Key ID: 716BC147715E716F
1 changed files with 1 additions and 1 deletions

View File

@ -34,7 +34,7 @@ func (s *SteamShop) Get(u *url.URL) (*models.Product, error) {
}
doc.Find(`.page_content_ctn`).Each(func(i int, s *goquery.Selection) {
priceText := strings.TrimSpace(s.Find(`.game_purchase_action .price`).Text())
priceText := strings.TrimSpace(s.Find(`.game_purchase_action .price`).First().Text())
priceValue, _ := s.Find(`.game_purchase_price.price`).Attr("data-price-final")
priceNum, _ := strconv.ParseFloat(strings.ReplaceAll(strings.Split(priceValue, " ")[0], ",", "."), 64)
// TODO: error logging