summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sotoudeh <matthewsot@outlook.com>2021-02-08 13:09:19 -0800
committerMatthew Sotoudeh <matthewsot@outlook.com>2021-02-08 13:09:19 -0800
commit43c341f6165a7b5105ee28451efe7e26d4eb197b (patch)
treef73520943c794f16335c627a5d0d39d633957c9f
parent163cc971592594979157d5ff438668e26c28dcd1 (diff)
Support arXiv RSS feeds
-rw-r--r--sources/rss-source.rkt8
1 files changed, 6 insertions, 2 deletions
diff --git a/sources/rss-source.rkt b/sources/rss-source.rkt
index d27a4c6..0c5b519 100644
--- a/sources/rss-source.rkt
+++ b/sources/rss-source.rkt
@@ -14,13 +14,17 @@
(let* ([port (get-cached-port url force-refresh)]
[xexpr (xml->xexpr (document-element (read-xml port)))]
[channels (parse-rss xexpr)]
- [items (rss-channel-items (car channels))])
+ [items (append-map rss-channel-items channels)])
(close-input-port port)
items)))
(struct rss-channel (title description items) #:transparent)
-(define (parse-rss xexpr) (map parse-channel (find-children 'channel xexpr)))
+(define (parse-rss xexpr)
+ ; Some RSS feeds drop the items directly under the <rdf> (see: arXiv) while
+ ; others wrap them in a <channel>. This picks up both.
+ (cons (parse-channel xexpr)
+ (map parse-channel (find-children 'channel xexpr))))
(define (parse-channel xexpr)
(rss-channel (se-path* '(channel title) xexpr)
(se-path* '(channel description) xexpr)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback