Patch from Maxim Velesyuk to fix parsing CNN feed
authorKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 18 Jun 2015 23:44:03 +0000 (17:44 -0600)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 18 Jun 2015 23:44:03 +0000 (17:44 -0600)
ChangeLog
debian/changelog
main.lisp

index 592ad3ba049f59c0a51a110a77724a9604330106..40ce4ae0c8e7f66c7f036748f948b802b5a600e1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-04 Kevin Rosenberg <kevin@rosenberg.net>
+       * Version 0.9.1
+       * main.lisp: Patch from Maxim Velesyik fixing errors parsing CNN
+       feed.
+
 2012-09-04 Kevin Rosenberg <kevin@rosenberg.net>
        * Version 0.9.0
        * Commit patch from Rupert Swarbrick: Parse RSS version 2 and
index d859c3821599a814aee38a06eb9e4aaf4dcc54cb..717fc26737da1029b83b00fa12aad8e88d51e50d 100644 (file)
@@ -1,3 +1,9 @@
+cl-rss (0.9.1-1) unstable; urgency=low
+
+  * New upstream
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Thu, 18 Jun 2015 17:43:36 -0600
+
 cl-rss (0.9.0-2) unstable; urgency=low
 
   * Switch to dpkg-source 3.0 (quilt) format
index 44fd7885797981e5662e23deb6077cfd9bc908c2..3545f936393e1cdfdde049dbf71888188e50e976 100644 (file)
--- a/main.lisp
+++ b/main.lisp
@@ -111,11 +111,14 @@ was already set."
 throwing an error if it was already set, or if they aren't a string. Used for
 elements like <title> and <link>, which shouldn't crop up twice."
   (let ((string (car (xmls:xmlrep-children node))))
-    (unless (stringp string)
-      (error 'rss-parse-error
-             :msg (format nil "Got ~A when expecting string for contents of <~A>"
-                          string name)))
-    (setf-unique-slot object name string)))
+    ;; skip empty nodes
+    (when string
+        (progn
+          (unless (stringp string)
+            (error 'rss-parse-error
+                   :msg (format nil "Got ~A when expecting string for contents of <~A>"
+                                string name)))
+          (setf-unique-slot object name string)))))
 
 (defun ensure-string-slots-filled (object required-slots strict?)
   "For each slot in REQUIRED-SLOTS, if it is unbound in OBJECT, set it to the
@@ -157,6 +160,9 @@ and BODY is performed with ITEM set to the item we're modifying and NODE set to
 the XML node we just got."
   `(defun ,name (node object strict?)
      (declare (ignorable strict?))
+     ;; skip atom-related tags
+     (when (equalp "http://www.w3.org/2005/Atom" (xmls:node-ns node))
+       (return-from ,name nil))
      (string=-case (xmls:xmlrep-tag node)
          (,@(mapcar
              (lambda (sym) `(,(symbol-to-name sym)