diff options
| author | unwox <me@unwox.com> | 2024-10-07 17:23:53 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2024-10-07 17:23:53 +0600 |
| commit | 838b49cb7b5895a8f2e334158ba47ff8f2734ed7 (patch) | |
| tree | 8641c37e15c80432527f0dcfcc146b2c58770c28 | |
| parent | 3214bfe479f1f77d0554d3e8fd56bc5d75180d57 (diff) | |
ipuer: also parse descriptions
| -rw-r--r-- | parser/ipuer.fnl | 24 |
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 |
