Innocenty Enikeew пре 7 година
родитељ
комит
5d7639d624
1 измењених фајлова са 9 додато и 4 уклоњено
  1. 9 4
      plugins/tescort.lisp

+ 9 - 4
plugins/tescort.lisp

@@ -30,7 +30,8 @@
              (:name . ("td:nth-of-type(2)"))
              (:city . ("td:nth-of-type(3)"))
              (:phone . ("td:nth-of-type(4)"))
-             (:comment . ("td:nth-of-type(5)"))))
+             (:comment . ("td:nth-of-type(5)"))
+             (:photos . ("td:nth-of-type(5) a" :attr :href :multiple t))))
      (:init . (("https://www.6annonce.com/private/signin")
                ".signin-box form"
                (("username" . annonce-login)
@@ -59,10 +60,14 @@
   (loop for (name . res) in results append res))
 
 (defun format-blacklist (item)
-  (format nil "~A, ~A: ~A *~A*~%~A"
+  (format nil "~A, ~A: ~A *~A*~%~A~@[~%~A~]"
           (agets item :date) (agets item :city)
           (agets item :name) (agets item :phone)
-          (agets item :comment)))
+          (agets item :comment)
+          (when (agets item :photos)
+            (format nil "~{[pic~A](~A)~^, ~}"
+                    (loop for i from 1 for p in (agets item :photos)
+                       append (list i p))))))
 
 (defun handle-blacklist (chat-id query)
   (with-chat-cookies (chat-id *chat-cookie-jars*)
@@ -72,7 +77,7 @@
                                     (text-chunks (mapcar #'format-blacklist results)
                                                  :pre-pre "" :pre-post "")
                                     "Not found")
-                        :parse-mode "markdown" :disable-web-preview "true"))))
+                        :parse-mode "markdown"))))
 
 (def-message-cmd-handler handler-cmd-blacklist (:blacklist :bl)
   (cond