diff options
| author | unwox <me@unwox.com> | 2025-03-14 22:12:23 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2025-03-14 22:12:23 +0600 |
| commit | 493acae9aa58523f323588d5b5f23f31acfb0f0f (patch) | |
| tree | b10f05b6f855b55e6cb96dc7259afc6ecd674cec /parser/artoftea.fnl | |
| parent | e7200ff8c6d745ed1e17e865932ea973dd71db41 (diff) | |
fix artfotea parser due to site update
Diffstat (limited to 'parser/artoftea.fnl')
| -rw-r--r-- | parser/artoftea.fnl | 66 |
1 files changed, 40 insertions, 26 deletions
diff --git a/parser/artoftea.fnl b/parser/artoftea.fnl index 1af4969..faef61d 100644 --- a/parser/artoftea.fnl +++ b/parser/artoftea.fnl @@ -8,36 +8,32 @@ (fn format-url [path page] (.. "https://artoftea.ru/" path - "/" (if (< 1 page) (.. "?page=" page) ""))) + (if (< 1 page) (.. "?page=" page) ""))) (local product-peg (* (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.tag :div {:class "product-thumb__image"} + (parser.tag :a {:href (peg.Cg (parser.till "\"") :url) :title "*"} + (* + (parser.anywhere (* "src=\"" (peg.Cg (parser.till "\"") :image) "\"")) + (parser.till "</a>"))))) (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.tag :a {:class "product-thumb__name" :href "*"} + (peg.Cg (parser.till "</a>") :title))) (+ (* (parser.anywhere - (parser.tag :option {:value "*" :selected "selected"} - (peg.Cg (parser.till "</option>") :weight))) + (parser.tag :option {:data-price-prefix "*" :data-price "*" + :value "*" :selected "selected"} + (peg.Cg (parser.till "</option>") :weight))) (parser.anywhere - (parser.tag :p {:class "price"} - (parser.tag :span {:id "*"} - (peg.Cg (parser.till "</span>") :price))))) + (parser.tag :span {:data-price "*" :class "*"} + (peg.Cg (parser.till "</span>") :price)))) (parser.anywhere - (parser.tag :p {:class "price"} - (parser.tag :span {:id "*"} - (peg.Cg (parser.till "</span>") :price))))) - (parser.anywhere - (parser.tag :button {:type "*" :onclick "*" :class "*"} "В корзину")))) + (parser.tag :span {:data-price "*" :class "*"} + (peg.Cg (parser.till "</span>") :price)))) + (parser.anywhere (parser.tag :span {} "В корзину")))) (fn normalize [product] (local year (parser.guess-year product.title)) @@ -69,14 +65,32 @@ {:path "whitetea" :tags ["Белый чай"]} {:path "yellowtea" :tags ["Желтый чай"]} {:path "xej-cha-chernyj-chaj" :tags ["Хэй ча"]} - {:path "posuda" :tags ["Посуда"]} - {:path "tipoty-lightking" :tags ["Посуда"]} - {:path "accesories" :tags ["Посуда"]} - {:path "matcha-i-aksessuary" :tags ["Матча"]} + {:path "posuda/gaiwans" :tags ["Посуда" "Гайвань"]} + {:path "posuda/cups" :tags ["Посуда" "Пиала"]} + {:path "posuda/chahai" :tags ["Посуда" "Чахай"]} + {:path "posuda/chainiki-steklo-farfor" :tags ["Посуда" "Стекло"]} + {:path "posuda/chainiki-isinskaya-glina" :tags ["Посуда" "Чайник" "Исин"]} + {:path "posuda/chayniki-iz-keramiki-farfora" :tags ["Посуда" "Чайник" "Керамика"]} + {:path "posuda/farfor-iz-tszindechzhen" :tags ["Посуда" "Цзиндэчжэнь"]} + {:path "posuda/keramika-iz-tszyanshuy" :tags ["Посуда" "Чайник" "Цзяньшуй"]} + {:path "posuda/keramika-iz-chaochzhou" :tags ["Посуда" "Чайник" "Чаочжоу"]} + {:path "posuda/posuda-iz-tsinchzhou" :tags ["Посуда" "Чайник" "Гуанси"]} + {:path "posuda/termosy-zavarochnyye-butylki" :tags ["Посуда" "Термос"]} + {:path "posuda/sama-kamjove" :tags ["Посуда" "Типот"]} + {:path "posuda/steklo" :tags ["Посуда" "Стекло"]} + {:path "posuda/nabory" :tags ["Посуда" "Набор"]} + {:path "posuda/ekskljuzivnaja-posuda" :tags ["Посуда" "Набор"]} + {:path "accesories/chaban" :tags ["Чабань"]} + {:path "accesories/instrumenty" :tags ["Инструмент"]} + {:path "accesories/tea-toys" :tags ["Фигурка"]} + {:path "accesories/tea-toys" :tags ["Фигурка"]} + {:path "accesories/chahe-strainers" :tags ["Сито"]} + {:path "accesories/miscellaneous" :tags ["Аксессуар"]} + {:path "accesories/firmenny-stil" :tags ["Мерч"]} + {:path "accesories/stikery" :tags ["Мерч"]} {:path "upakovka" :tags ["Упаковка"]} {:path "eksklyuzivny-chay"} - {:path "taiwan-tea" :tags ["Тайвань"]} - {:path "sinij-chaj" :tags ["Синий чай"]}] + {:path "taiwan-tea" :tags ["Тайвань"]}] format-url product-peg normalize)) |
