From 838b49cb7b5895a8f2e334158ba47ff8f2734ed7 Mon Sep 17 00:00:00 2001 From: unwox Date: Mon, 7 Oct 2024 17:23:53 +0600 Subject: ipuer: also parse descriptions --- parser/ipuer.fnl | 24 +++++++++++++----------- 1 file 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 "") :title))))) + (parser.tag :div {:class "card-product_title"} + (parser.tag :a {:href "*"} + (parser.tag :span {} (peg.Cg (parser.till "") :title))))) + ;; description + (parser.anywhere + (parser.tag :div {:class "card-product_description"} + (peg.Cg (parser.till "") :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 -- cgit v1.2.3