summaryrefslogtreecommitdiff
path: root/parser/ipuer.fnl
diff options
context:
space:
mode:
Diffstat (limited to 'parser/ipuer.fnl')
-rw-r--r--parser/ipuer.fnl24
1 files changed, 13 insertions, 11 deletions
diff --git a/parser/ipuer.fnl b/parser/ipuer.fnl
index 11e63c0..8b0f6be 100644
--- a/parser/ipuer.fnl
+++ b/parser/ipuer.fnl
@@ -9,25 +9,28 @@
(local fetcher (require :fetcher))
(fn format-url [path page]
- (.. "https://ipuer.ru/catalog/" path "/?p=" page))
+ (.. "https://ipuer.ru/catalog/" path "/?viewAs=table&p=" page))
(local product-peg
(* ;; id
(parser.anywhere
- (parser.tag :div
- {:data-id (peg.Cg parser.pegs.number :id) :class "*"}))
+ (parser.tag :div {:data-id (peg.Cg parser.pegs.number :id) :class "*"}))
;; url and image
(parser.anywhere
- (parser.tag :a {:href (peg.Cg (parser.till "\"") :url)}
- (parser.tag :img {:src (peg.Cg (parser.till "\"") :image) :alt "*"})))
+ (parser.tag :a {:href (peg.Cg (parser.till "\"") :url)}
+ (parser.tag :img {:src (peg.Cg (parser.till "\"") :image) :alt "*"})))
;; title
(parser.anywhere
- (parser.tag :div {:class "card-product_title"}
- (parser.tag :a {:href "*"}
- (parser.tag :span {} (peg.Cg (parser.till "</span>") :title)))))
+ (parser.tag :div {:class "card-product_title"}
+ (parser.tag :a {:href "*"}
+ (parser.tag :span {} (peg.Cg (parser.till "</span>") :title)))))
+ ;; description
+ (parser.anywhere
+ (parser.tag :div {:class "card-product_description"}
+ (peg.Cg (parser.till "</div>") :description)))
;; price
(parser.anywhere
- (parser.tag :span {:class "card-price"}
+ (parser.tag :span {:class "card-price_new"}
(* (peg.Cg
(* parser.pegs.number
(parser.maybe (* " " parser.pegs.number)))
@@ -44,8 +47,7 @@
:id product.id
:url (.. "https://ipuer.ru" product.url)
:title product.title
- :description ""
- ;; FIXME: parse all editions into different projects
+ :description product.description
:image (.. "https://ipuer.ru" product.image)
:year (parser.guess-year product.title)
:price price