|
|
@@ -17,6 +17,10 @@
|
|
|
(defun get-by-tag (node tag)
|
|
|
(nreverse (plump:get-elements-by-tag-name node tag)))
|
|
|
|
|
|
+(defun url-parse (url)
|
|
|
+ (plump:parse (flexi-streams:octets-to-string
|
|
|
+ (dex:get (http-default url) :force-binary t) :external-format :utf-8)))
|
|
|
+
|
|
|
(defun find-rss-url (url)
|
|
|
(ignore-errors
|
|
|
(multiple-value-bind (body status headers uri stream)
|
|
|
@@ -35,8 +39,7 @@
|
|
|
(quri:render-uri uri)))))))
|
|
|
|
|
|
(defun build-feed (url)
|
|
|
- (let ((root (plump:parse (flexi-streams:octets-to-string
|
|
|
- (dex:get url :force-binary t) :external-format :utf-8))))
|
|
|
+ (let ((root (url-parse url)))
|
|
|
(make-feed :url url :title (child-text root "title"))))
|
|
|
|
|
|
(defun adjust-period (feed coeff)
|
|
|
@@ -91,11 +94,7 @@
|
|
|
|
|
|
(defun parse-rss (url)
|
|
|
(let ((plump:*tag-dispatchers* plump:*xml-tags*))
|
|
|
- (loop for item in (get-by-tag
|
|
|
- (plump:parse
|
|
|
- (flexi-streams:octets-to-string
|
|
|
- (dex:get url :force-binary t) :external-format :utf-8))
|
|
|
- "item")
|
|
|
+ (loop for item in (get-by-tag (url-parse url) "item")
|
|
|
collect (make-feed-item :guid (child-text item "guid")
|
|
|
:link (child-text item "link")
|
|
|
:title (clean-text (child-text item "title"))
|