diff options
Diffstat (limited to 'parser/ozchai.fnl')
| -rw-r--r-- | parser/ozchai.fnl | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/parser/ozchai.fnl b/parser/ozchai.fnl index 16a3265..937a35b 100644 --- a/parser/ozchai.fnl +++ b/parser/ozchai.fnl @@ -1,5 +1,6 @@ (import-macros {: map} :lib.macro) +(local parser (require :parser.parser)) (local array (require :lib.array)) (local http (require :lib.http)) (local number (require :lib.number)) @@ -23,6 +24,11 @@ (local gallery (json.decode product.gallery)) (local weight (number.string->number (. product.editions 1 :Вес))) (local price (number.string->number (. product.editions 1 :price))) + (var volume nil) + (each [_ c (ipairs product.characteristics)] + (when (= (. c :title) "Объем") + (set volume (parser.guess-volume c.value)))) + {:site "ozchai" :id product.url :url product.url @@ -33,6 +39,7 @@ (. gallery 1 :img) "") :weight weight + :volume volume :price price :price-per (if (and price weight (< 0 weight)) (/ (math.ceil (* (/ price weight) 10)) 10) |
