Feed
Writing about this website made me write more in general these couple of days. Sharp-eyed readers will notice a new blog post on the topic of walled gardens, and another story which I'll share when it's finished. This new situation - which is making me extremely happy by the way - made me think about how I might publicize the newly created content. It seems that the easiest way to start would be to use Atom or RSS. I believe both are usable by people who are using that kind of stuff, but I do want to look at both in a bit more detail to see which one I prefer as a producer. Due to the way I'm updating this space, I'm probably going to need to build a custom solution to create the feeds. Concretely, I'm posting content as I write it and planning to continue doing so, so I'll need to find a way to syndicate updates only when they are done. Optionally, I might also spend some time on pushing live updates to the website, at least the way JIRA (which I dislike intensely) does it where a notification pops up every time there's an update, but the current view doesn't actually change.
It seems that Atom is more modern, but that it doesn't something called <encapsulation> which is apparently useful for podcasts. I'm not sure if I'm going to be doing any in near future, so let's do Atom first. Maybe supporting both later is not going to be hard.
I was looking into libraries I could use, just to play with it, and found atoma, which is used for parsing, and that then turned my attention to how I've migrated my poetry. What I encountered then was a weird XML which I ended up parsing forcefully - but what if I had used this library? It's amazing how short the short term memory is, because it turns out I had actually installed it for that project, but when I tried it out it failed.
>>> atoma.parse_rss_file('backup.xml')
...
atoma.exceptions.FeedParseError: Cannot process RSS feed version "None"
I'm sure you can see my error here. I tried parsing the file as RSS, instead of using parse_atom_file to parse my Atom backup. Here's what the official README is saying about parsing at the time of writing:
# Load and parse an Atom XML file:
>>> import atoma
>>> feed = atoma.parse_rss_file('rss-feed.xml')
Well, this is simply not true, and I just posted a PR to fix the docs. Atoma still seems like a great library, but the docs need some work. Finally, it doesn't seem that it has support for Blogger drafts, so parsing the feed manually turned out to be useful in the end.
So this was one huge distraction. Let's see what needs to be done to actually export the feed.
I stopped myself from adding one of those 5 hours later Sponge Bob Squarepants intermissions at this point. It seems that one of the cleanest way to do this would be to start using microformats2 when writing these posts, and then having a script look for changes in the HTML at regular intervals. I'm going to try to create a mock document and see how easy it really is before committing to using it in this and other pages.