Browse Source

Fix post number parsing.

We need to strip commas in long numbers like 10,000.
master
cecograph 6 months ago
parent
commit
3f09e0257e
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      src/cl-kiwi.lisp

+ 3
- 2
src/cl-kiwi.lisp View File

@@ -141,9 +141,10 @@

(defun extract-number (dom-element)
"Extract the post number from HTML/DOM."
(let ((trim-chars '(#\Space #\Linefeed #\Return #\#)))
(let ((number-string (elt (lquery:$ dom-element "li a" (text)) 1)))
(parse-integer
(string-trim trim-chars (elt (lquery:$ dom-element "li a" (text)) 1)))))
(apply #'concatenate
(cons 'string (cl-ppcre:split "\\W|#," number-string))))))

(defun extract-ratings (dom-element)
"Extract the post ratings from HTML/DOM. (Requires another HTTP call.)"


Loading…
Cancel
Save