Google Reader was shut down. Luckily Google Takeout allowed you to download all of your data before the shut it down. I did that. I wanted to extract all the URLs to the articles I starred in order to post them on this blog… maybe.
Here’s how I did it. First, take a look at the file
(setq starred-items (with-current-buffer “starred.json (Google Reader-takeout.zip)” (goto-char (point-min)) (json-read))) (mapcar (lambda (item) (car item)) starred-items) ⇒ (items direction updated author title id)
I’m interested in
items, which happens to be an array. Let’s see what each item contains.
(mapcar (lambda (item) (car item)) (aref (cdr (assoc-string “items” starred-items)) 0)) ⇒ (origin annotations comments author content replies alternate updated published title categories id timestampUsec crawlTimeMsec)
As it happens, the URL I’m interested in is part of
alternate. Let’s make sure there’s always exactly one entry:
(mapc (lambda (item) (when (not (= 1 (length (cdr (assoc-string “alternate” item))))) (error “%S” item))) (cdr (assoc-string “items” starred-items)))
Phew! Let’s produce a first list of URLs and the respective titles:
(mapc (lambda (item) (let ((href (cdr (assoc-string “href” (aref (cdr (assoc-string “alternate” item)) 0)))) (title (cdr (assoc-string “title” item)))) (insert (format “* [%s %s]\n” href title)))) (cdr (assoc-string “items” starred-items)))
I hate feedproxy URLs and so I absolutely wanted to get rid of all the URLs starting with
http://feedproxy.google.com/. This required a bit more code since neither
url-retrieve do exactly what I want.
(defun redirection-target (url) (save-match-data (let ((url-request-method “HEAD”) (retrieval-done nil) (spinner “-\|/”) (n 0)) (url-retrieve url (lambda (status &rest ignore) (setq retrieval-done t url (plist-get status :redirect) url (replace-regexp-in-string “blogspot
.ch” “blogspot.com” url) url (replace-regexp-in-string “
?utm.*” “” url)))) (while (not retrieval-done) (sit-for 1) (message “Waiting… %c” (aref spinner (setq n (mod (1+ n) (length spinner)))))) url)))
Now I can run the following search an replace operation in the buffer where I generated my list:
(while (re-search-forward “http://feedproxy
S-+” nil t) (replace-match (redirection-target (match-string 0))))
Phew, thank you, Emacs!
I’ve been looking through the old blog posts I starred on Google Reader. There are so many of them! Looking at the 42 links for July 2009, I’d suggest the following are still relevant today. I’m not listing the links to “Why B/X is my favorite” because I already did that in my 2012 post Ode to Ode to Black Dougal.
- Finally Ready for Prime Time: Self-filling Expert Dungeons and Dragons Character Sheet – apparently a character generator for B/X D&D; I never used it
- S&S Indeed – using spears instead of swords as your primary weapon and assigning a different armor class to armor (none is still 9, plate is now 6 and a normal shield adds -3); I never used it but keep thinking about shields (personally I use a Shields Shall Be Splintered house rule but I’m not too happy about it either
- He Wants to Hold Your Hand, Hand, Hand, Hand… – the octopus character class; I never used but keep thinking about it…
- The FRPG Social Contract – “The simple fact is that no amount of rules can prevent a crappy GM from being a crappy GM.” So true.
- Sanity – “If a character witnesses an unspeakable horror, the Game Master may require the player to make a saving throw […]. If the character fails his or her saving throw, he or she loses points of temporary Wisdom. The exact amount should be determined by rolling 1d6. If a ‘6’ is rolled, the character also permanently loses one point of Wisdom (i.e., one permanent point of Wisdom and five temporary points of Wisdom). Temporarily lost points of Wisdom may be regained at a rate of one point per day of complete rest.” I never used it but it looks like a nice house rule if you need a sanity stat.
- Magicians and the Colours of Magic – white, grey and black magic; merging clerics and magic users; I keep wondering about this but I don’t know whether I’m ready to drop the D&D tropes
- Old School Skills in Action The Rogue – another thief alternative class (more house rules are available from the Swords & Sorcery House Rules Index)
- Is Old School the New Cool? – I think this was the first moment where I thought that perhaps old school D&D was going to be important; who would have thought?
- Labyrinth Lord vs. Basic D&D BX – comparing LL and B/X
- Katana Schmatana – I need this link to counter katana fanboys
- What I Look For in a Set of Fantasy RPG Rules – a nice checklist that I agree with (hence why B/X D&D is best, haha)
- Quote of the Day – “I enjoy the challenge of building characters” and “I enjoy the challenge of playing (a character)” is the biggest division in the games hobby.
- RPG Resources of the Day: Random Generators for Names and More
- RPG Resources of the Day: Two Sites with Hundreds of Real Historical City Maps (there was also a list of links for “Fantasy City, Town and Village Maps” but the ones I tried were all broken)
- Time in the Old School Campaign – we’re playing every two weeks and thus I’m generally using “two weeks in real time = one week in game time” and use “one move = one day” for travel in order to figure out whether a particular expedition takes more than a week of game time
- Ancient Chinese Secrets – the D&D “endgame” is simply player characters achieving powerful status in a campaign world and if future campaigns keep using the same world, that’s your endgame
- OD&D Random Strongholds – “A couple of random strongholds generated from OD&D Vol III” to give you an impression of what you could expect to encounter as you moved around
- Well Bob is dead... – a table to use if your players are callous and leave their dead companions to rot; my players are not that callous all joking aside and so I had no use for this table until now
Perhaps I should add some of these links to the Links to Wisdom wiki.