Get RSS feed entries in orgmode from orgtable
Orgmode can read RSS feeds by calling the function org-feed-update-all
. In this post I wrote a function that can read RSS entries from an orgmode table. Then it assigns these entries to the variable org-feed-alist
. The basic idea is to manage my feeds list in a handy manner. My emacs init file is written in orgmode format, so I can edit my RSS feed entries in my init.org
to add or remove entries in a convenient manner. Thus, the following code chunks are into my Emacs init file.
Emacs lisp function for reading the table
Table with the data
The variable org-feed-alist
has four arguments: name
, URL
, file
, headline
(see C-h v org-feed-alist
or (describe-variable 'org-feed-alist)
).
#+NAME: table-rss
| Music Perception | http://mp.ucpress.edu/rss/current.xml | ~/rss/feeds.org | Music Perception - Current Issue |
| Frontiers in Psychology | http://journal.frontiersin.org/journal/psychology/rss | ~/rss/feeds.org | Frontiers in Psychology |
| Nature Podcast | http://feeds.nature.com/nature/podcast/current | ~/rss/feeds.org | Nature Podcast |
| Nature Journal | http://feeds.nature.com/nature/rss/current | ~/rss/feeds.org | Nature Journal - Current Issue |
Read entries from org table
The following function rss-feed
is based on this example.
#+BEGIN_SRC emacs-lisp :session :results silent
(defun rss-feed (table)
"Get RSS feed from the table and assign its contents to org-feed-alist."
(setq mylst nil)
(while table
(setq mylst (cons (car table) mylst))
(setq table (cdr table)))
(setq org-feed-alist mylst))
#+END_SRC
Call elisp function rss-feed
Run rss-feed
function to set the value of the variable org-feed-alist
.
#+BEGIN_SRC emacs-lisp :session :var tbl=table-rss :results silent
(rss-feed tbl)
#+END_SRC
Update RSS feed
M-x org-feed-update-all
General discussion
Orgmode RSS feed are not handy. One major drawback is that there is no correspondence between published date and time of the feeds. Instead org feeds contain the information of the retrieved date and time. I also noticed that some RSS feeds are not compatible. While, the orgfeeds are in orgmode document format, which gives plenty of opportunities, it seems the elfeed is more appropriate library for RSS feeds.