|
|
@@ -14,6 +14,9 @@
|
|
|
(quri:uri (format nil "http://~A" url))
|
|
|
uri))))
|
|
|
|
|
|
+(defun get-by-tag (node tag)
|
|
|
+ (nreverse (plump:get-elements-by-tag-name node tag)))
|
|
|
+
|
|
|
(defun find-rss-url (url)
|
|
|
(ignore-errors
|
|
|
(multiple-value-bind (body status headers uri stream)
|
|
|
@@ -23,7 +26,7 @@
|
|
|
(content-type (gethash "content-type" headers)))
|
|
|
(cond
|
|
|
((alexandria:starts-with-subseq "text/html" content-type)
|
|
|
- (loop for link in (plump:get-elements-by-tag-name root "link")
|
|
|
+ (loop for link in (get-by-tag root "link")
|
|
|
when (string= "application/rss+xml" (plump:attribute link "type"))
|
|
|
do (return (quri:render-uri
|
|
|
(quri:merge-uris (quri:uri (plump:attribute link "href"))
|
|
|
@@ -80,8 +83,7 @@
|
|
|
(r node))))
|
|
|
|
|
|
(defun child-text (node tag)
|
|
|
- (alexandria:when-let (child (car (nreverse
|
|
|
- (plump:get-elements-by-tag-name node tag))))
|
|
|
+ (alexandria:when-let (child (car (get-by-tag node tag)))
|
|
|
(trim-nil (text-with-cdata child))))
|
|
|
|
|
|
(defun clean-text (text)
|
|
|
@@ -89,7 +91,7 @@
|
|
|
|
|
|
(defun parse-rss (url)
|
|
|
(let ((plump:*tag-dispatchers* plump:*xml-tags*))
|
|
|
- (loop for item in (plump:get-elements-by-tag-name
|
|
|
+ (loop for item in (get-by-tag
|
|
|
(plump:parse
|
|
|
(flexi-streams:octets-to-string
|
|
|
(dex:get url :force-binary t) :external-format :utf-8))
|