summaryrefslogtreecommitdiff
path: root/parser
diff options
context:
space:
mode:
Diffstat (limited to 'parser')
-rw-r--r--parser/artoftea.fnl74
-rw-r--r--parser/ozchai.fnl2
2 files changed, 46 insertions, 30 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))
diff --git a/parser/ozchai.fnl b/parser/ozchai.fnl
index 50bfd6a..f1bbcae 100644
--- a/parser/ozchai.fnl
+++ b/parser/ozchai.fnl
@@ -28,7 +28,7 @@
:url product.url
:title product.title
:description product.descr
- ;; FIXME: parse all editions into different projects
+ ;; FIXME: parse all editions into different products
:image (if (< 0 (# gallery))
(. gallery 1 :img)
"")