diff options
Diffstat (limited to 'parser/artoftea.fnl')
| -rw-r--r-- | parser/artoftea.fnl | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/parser/artoftea.fnl b/parser/artoftea.fnl index 386dc77..1421a86 100644 --- a/parser/artoftea.fnl +++ b/parser/artoftea.fnl @@ -21,26 +21,30 @@ (parser.anywhere (parser.tag :a {:class "product-thumb__name" :href "*"} (peg.Cg (parser.till "</a>") :title))) - (+ - (* - (parser.anywhere + (parser.anywhere + (+ + (* (parser.tag :option {:data-price-prefix "*" - :data-price (peg.Cg (parser.till "\"") :price) + :data-price (peg.Cg (parser.till "\"") :amount) :value "*" :selected "selected"} - (peg.Cg (parser.till "</option>") :weight))) - (parser.anywhere - (parser.tag :span {:data-price "*" :class "*"} + (peg.Cg (parser.till "</option>") :weight)) + (parser.anywhere + (parser.tag :span {:data-price (peg.Cg (parser.till "\"") :price) + :class "*"} + (parser.till "</span>")))) + (parser.tag :span {:data-price (peg.Cg (parser.till "\"") :price) + :class "*"} (parser.till "</span>")))) - (parser.anywhere - (parser.tag :span {:data-price "*" :class "*"} - (peg.Cg (parser.till "</span>") :price)))) (parser.anywhere (parser.tag :span {} "В корзину")))) (fn normalize [product] (local year (parser.guess-year product.title)) (local weight (or (parser.guess-weight product.weight ["г"]) (parser.guess-weight product.title))) - (local price (number.string->number product.price)) + (local amount (if product.amount + (number.string->number product.amount) + 1)) + (local price (* (number.string->number product.price) amount)) {:site "artoftea" :title product.title |
