add good_id
All checks were successful
Build and push image / deploy (push) Successful in 2m36s

This commit is contained in:
2024-01-03 01:01:56 +03:00
parent 7acb7393a3
commit c4e71fca93
5 changed files with 53 additions and 0 deletions

View File

@ -181,6 +181,16 @@ type Good struct {
Price float64
}
func (g *Good) GoodID() int {
linkArr := strings.Split(g.GoodLink, "/")
if len(linkArr) < 3 {
return 0
}
id, _ := strconv.Atoi(linkArr[3])
return id
}
func parseGoodsCategory(r io.Reader) ([]*Good, error) {
doc, err := goquery.NewDocumentFromReader(r)
if err != nil {