diff options
author | Matthew Sotoudeh <matthewsot@outlook.com> | 2021-02-08 13:09:19 -0800 |
---|---|---|
committer | Matthew Sotoudeh <matthewsot@outlook.com> | 2021-02-08 13:09:19 -0800 |
commit | 43c341f6165a7b5105ee28451efe7e26d4eb197b (patch) | |
tree | f73520943c794f16335c627a5d0d39d633957c9f | |
parent | 163cc971592594979157d5ff438668e26c28dcd1 (diff) |
Support arXiv RSS feeds
-rw-r--r-- | sources/rss-source.rkt | 8 |
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) |