diff options
| author | unwox <me@unwox.com> | 2024-10-07 20:19:59 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2024-10-08 14:06:42 +0600 |
| commit | 4cf902d6f0f41befeb2e028cb394cb454c2ba73c (patch) | |
| tree | 4937f249e6ab016932bbe3f54a9fc52f7064e18f /parser/artoftea.fnl | |
| parent | 47af967213c48565adadc68d43fc572159c31ed9 (diff) | |
small fixes
Diffstat (limited to 'parser/artoftea.fnl')
| -rw-r--r-- | parser/artoftea.fnl | 74 |
1 files changed, 45 insertions, 29 deletions
diff --git a/parser/artoftea.fnl b/parser/artoftea.fnl index 205d5d0..b1a8c72 100644 --- a/parser/artoftea.fnl +++ b/parser/artoftea.fnl @@ -12,37 +12,38 @@ (.. "https://artoftea.ru/" path "/?page=" page)) (local product-peg - (* ;; id - (parser.anywhere - (parser.tag :div {:class "front-image"} - (parser.tag :a {:href (peg.Cg (parser.till "\"") :url)} - (parser.tag :img {:src (peg.Cg (parser.till "\"") :image) - :title "*" :class "*" :alt "*"})))) - (parser.anywhere - (parser.tag :div {:class "name"} - (parser.tag :a {:href "*"} (peg.Cg (parser.till "</a>") :title)))) - (parser.anywhere - (parser.tag :p {:class "description"} - (peg.Cg (parser.till "</p>") :description))) - (+ - (* - (parser.anywhere - (parser.tag :option {:value "*" :selected "selected"} - (* (peg.Cg parser.pegs.number :weight) " гр" parser.pegs.spaces))) - (parser.anywhere - (parser.tag :p {:class "price"} - (parser.tag :span {:id "*"} - (peg.Cg (parser.till "</span>") :price))))) + (* + (parser.anywhere + (parser.tag :div {:class "front-image"} + (parser.tag :a {:href (peg.Cg (parser.till "\"") :url)} + (parser.tag :img {:src (peg.Cg (parser.till "\"") :image) + :title "*" :class "*" :alt "*"})))) + (parser.anywhere + (parser.tag :div {:class "name"} + (parser.tag :a {:href "*"} (peg.Cg (parser.till "</a>") :title)))) + (parser.anywhere + (parser.tag :p {:class "description"} + (peg.Cg (parser.till "</p>") :description))) + (+ + (* + (parser.anywhere + (parser.tag :option {:value "*" :selected "selected"} + (* (peg.Cg parser.pegs.number :weight) (+ (peg.P "г") " гр") + parser.pegs.spaces))) (parser.anywhere (parser.tag :p {:class "price"} - (parser.tag :span {:id "*"} - (peg.Cg (parser.till "</span>") :price))))) - (parser.anywhere - (parser.tag :input {:type "hidden" - :name "product_id" - :value (peg.Cg parser.pegs.number :id)})) + (parser.tag :span {:id "*"} + (peg.Cg (parser.till "</span>") :price))))) (parser.anywhere - (parser.tag :button {:type "*" :onclick "*" :class "*"} "Купить")))) + (parser.tag :p {:class "price"} + (parser.tag :span {:id "*"} + (peg.Cg (parser.till "</span>") :price))))) + (parser.anywhere + (parser.tag :input {:type "hidden" + :name "product_id" + :value (peg.Cg parser.pegs.number :id)})) + (parser.anywhere + (parser.tag :button {:type "*" :onclick "*" :class "*"} "Купить")))) (fn normalize [product] (local year (parser.guess-year product.title)) @@ -64,7 +65,22 @@ (fn products [] (fetcher.from-html [{:path "redtea" :category "Красный чай"} - {:path "greentea" :category "Зеленый чай"}] + {:path "greentea" :category "Зеленый чай"} + {:path "puer/shu-puer" :category "Шу пуэр"} + {:path "puer/sheng-puer" :category "Шен пуэр"} + {:path "rassypnoi-puer"} + {:path "oolong" :category "Улун"} + {:path "whitetea" :category "Белый чай"} + {:path "yellowtea" :category "Желтый чай"} + {:path "xej-cha-chernyj-chaj" :category "Хэй ча"} + {:path "posuda" :category "Посуда"} + {:path "tipoty-lightking" :category "Посуда"} + {:path "accesories" :category "Аксессуары"} + {:path "matcha-i-aksessuary"} + {:path "upakovka"} + {:path "eksklyuzivny-chay"} + {:path "taiwan-tea"} + {:path "sinij-chaj"}] format-url product-peg normalize)) |
