summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/utils.fnl8
-rw-r--r--parser/artoftea.fnl6
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/utils.fnl b/lib/utils.fnl
index 3220952..fcc235c 100644
--- a/lib/utils.fnl
+++ b/lib/utils.fnl
@@ -2,4 +2,10 @@
(local (ok? result) ...)
(if ok? result (error result)))
-{: must}
+(fn measure [what f]
+ (local start (luna.utf8.now))
+ (local res (table.pack (f)))
+ (print (.. what ": " (/ (- (luna.utf8.now) start) 1e6)))
+ (values (table.unpack res)))
+
+{: must : measure}
diff --git a/parser/artoftea.fnl b/parser/artoftea.fnl
index c2fdc8f..5339a3f 100644
--- a/parser/artoftea.fnl
+++ b/parser/artoftea.fnl
@@ -39,11 +39,7 @@
(parser.tag :span {:id "*"}
(peg.Cg (parser.till "</span>") :price)))))
(parser.anywhere
- (parser.tag :input {:type "hidden"
- :name "product_id"
- :value (peg.Cg parser.pegs.number :id)}))
- (parser.anywhere
- (parser.tag :button {:type "*" :onclick "*" :class "*"} "Купить"))))
+ (parser.tag :button {:type "*" :onclick "*" :class "*"} "В корзину"))))
(fn normalize [product]
(local year (parser.guess-year product.title))