Created
March 30, 2013 20:54
-
-
Save Idorobots/5278294 to your computer and use it in GitHub Desktop.
Export your RSS feeds from Google Reader into Emacs News Ticker compatible format.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'xml) | |
(defun assoc-or-error (what where &optional err-string) | |
(or (assoc what where) | |
(error (or err-string "Suddenly errors! Thousands of them!")))) | |
(defun google-reader-to-newsticker (filename) | |
"Parses google-reader subscription XML and returns newsticker compatible feed alist." | |
(with-temp-buffer | |
(insert-file-contents filename) | |
(let* ((opml (assoc-or-error 'opml | |
(xml-parse-region (point-min) (point-max)) | |
"Not a valid feed XML!")) | |
(body (assoc-or-error 'body | |
opml | |
"Not a valid feed XML!")) | |
(outlines (delq nil | |
(map 'list | |
(lambda (element) | |
(and (consp element) | |
(equal (car element) 'outline) | |
element)) | |
body))) | |
(alist (map 'list | |
(lambda (outline) | |
(let ((title (assoc-or-error 'title | |
outline | |
"No title in an outline - malformed feed XML?")) | |
(feed (assoc-or-error 'xmlUrl | |
outline | |
"No feed link in an outline - check your feed XML!"))) | |
(list (cdr title) (cdr feed)))) | |
(map 'list | |
#'cadr | |
outlines)))) | |
alist))) |
Weird, on my end it seems to be working and no parentheses are missing.
On a side note, a probably better solution is to use the builtin Newsticker importer - newsticker-opml-import
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for writing this conversion code from Greader to Emacs News Ticker (and the guide http://idorobots.org/2013/03/30/greader-alternative). After adding two parentheses to the last line (which I think were missing because otherwise we would get an unbalanced parentheses error) and running
I get the following error:
Am I missing something here?