diff options
| author | unwox <me@unwox.com> | 2024-10-17 16:41:13 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2024-10-17 16:41:13 +0600 |
| commit | 57bed786370154fddca335a3552166e089ef1fd2 (patch) | |
| tree | 3afa8b1c1166472f6dfa5b8db9c4750c03b6caf1 | |
| parent | 5e4fddbcd0ca9ce2c76b40849a57f8a7796fed1c (diff) | |
fix clubcha parsing
| -rw-r--r-- | parser/clubcha.fnl | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/parser/clubcha.fnl b/parser/clubcha.fnl index 4bfe8ec..a32f767 100644 --- a/parser/clubcha.fnl +++ b/parser/clubcha.fnl @@ -31,24 +31,34 @@ (parser.anywhere (parser.tag :span {:class "js-prod-price"} (peg.Cg (^ (+ parser.pegs.number parser.pegs.spaces) 1) :price))) - (parser.maybe - (parser.anywhere - (parser.tag - :option - {:data-price "*" - :data-stock "*" - :data-units "*" - :data-oldprice "*" - :value "*"} - (peg.Cg (parser.till "</option>") :weight)))) - (parser.anywhere - (parser.tag - :button - {:type "submit" - :value "Купить" - :data-added-text "В корзине" - :class "*"} - (parser.anywhere "Купить"))))) + (+ + (* + (parser.anywhere + (parser.tag + :option + {:selected "" + :data-price "*" + :data-stock "*" + :data-units "*" + :data-oldprice "*" + :value "*"} + (peg.Cg (parser.till "</option>") :weight))) + (parser.anywhere + (parser.tag + :button + {:type "submit" + :value "Купить" + :data-added-text "В корзине" + :class "*"} + (parser.anywhere "Купить")))) + (parser.anywhere + (parser.tag + :button + {:type "submit" + :value "Купить" + :data-added-text "В корзине" + :class "*"} + (parser.anywhere "Купить")))))) (fn normalize [product] (local weight (parser.guess-weight product.weight)) |
