From e7200ff8c6d745ed1e17e865932ea973dd71db41 Mon Sep 17 00:00:00 2001 From: unwox Date: Wed, 5 Mar 2025 23:27:59 +0600 Subject: small improvements --- parser/kolokolnikovchai.fnl | 15 +++++++-------- parser/ozchai.fnl | 3 ++- parser/tea108.fnl | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/parser/kolokolnikovchai.fnl b/parser/kolokolnikovchai.fnl index cc5d723..acf52c5 100644 --- a/parser/kolokolnikovchai.fnl +++ b/parser/kolokolnikovchai.fnl @@ -65,14 +65,13 @@ {:path "990406163191" :tags ["Зеленый чай"]} {:path "451142994821" :tags ["Улун"]} {:path "770906787081" :tags ["Габа"]} - {:path "909586139961" :tags ["Посуда"]} ;; чайники - {:path "351075619951" :tags ["Посуда"]} ;; гайвани - {:path "874916565001" :tags ["Посуда"]} ;; пиалы - {:path "927453990401" :tags ["Посуда"]} ;; чахаи - {:path "242398612931" :tags ["Посуда"]} ;; чайные доски - {:path "208270710991" :tags ["Посуда"]} ;; чайные аксессуары - {:path "542771614531" :tags ["Посуда"]} ;; заварники - ] + {:path "909586139961" :tags ["Посуда" "Чайник"]} + {:path "351075619951" :tags ["Посуда" "Гайвань"]} + {:path "874916565001" :tags ["Посуда" "Пиала"]} + {:path "927453990401" :tags ["Посуда" "Чахай"]} + {:path "242398612931" :tags ["Посуда" "Чабань"]} + {:path "208270710991" :tags ["Посуда" "Аксессуар"]} + {:path "542771614531" :tags ["Посуда" "Заварник"]}] format-url destruct-response normalize)) diff --git a/parser/ozchai.fnl b/parser/ozchai.fnl index 1d4c4f3..e59ddf0 100644 --- a/parser/ozchai.fnl +++ b/parser/ozchai.fnl @@ -22,7 +22,8 @@ (fn normalize [product] (local gallery (json.decode product.gallery)) - (local weight (number.string->number (. product.editions 1 :Вес))) + (local weight (or (parser.guess-weight (. product.editions 1 :Вес)) + (number.string->number (. product.editions 1 :Вес)))) (local price (number.string->number (. product.editions 1 :price))) (var volume nil) (each [_ c (ipairs product.characteristics)] diff --git a/parser/tea108.fnl b/parser/tea108.fnl index 2fd013f..6a61f34 100644 --- a/parser/tea108.fnl +++ b/parser/tea108.fnl @@ -46,8 +46,8 @@ :volume (parser.guess-volume product.title) :category product.category :price-per (if (and price weight (< 0 weight)) - (/ (math.ceil (* (/ price weight) 10)) 10) - nil)}) + (/ (math.ceil (* (/ price weight) 10)) 10) + nil)}) (fn products [] (fetcher.from-html -- cgit v1.2.3