How I imported my MovableType 2.6 blog to Blogger
I finally got tired of maintaining the amalgamation of Perl and BerkelyDB that is MovableType, so I decided to switch to Blogger. Here's how I did it.
First, I read the slightly confusing docs on the Atom API on Blogger's web site. Then I wrote some code that uses Twisted to talk to this API. Unfortunately, the API didn't support comment creation, and I definitely wanted to import comments, so I whipped out Ethereal and recorded a session of creating a comment via the web user interface. Fortunately, it was quite straightforward: a post to /login-comment.do with the parameters "blogID", "postID", and "postBody" (be sure to have the garbled-word comment verification turned off, or else it'll also want an argument for that). So I wrote some more Python/Twisted code to do that.
That took about 2 hours, I think. Given the python interface to the blogger API, I then needed to figure out how to extract the posts and comments from my existing MT blog. So I scribbled up a template in MT that includes all useful data in a nice, machine-readable format. Well, it wasn't nice, but it did the trick. I threw together some code to parse that format and call the blogger API to create all the posts, and that was that.
If you'd like to see it: code, MT template.
2 comments:
Hi,
Sorry you had so much trouble with our docs. What exactly went wrong?
As for backwards compatibility with the RSS feed, you can use a 301 to point it to the new feed.
I have no idea. I admit I was doing it pretty late last night, and I might have confused myself a few times. One of the problems was that it was hard to find in the first place (I could only do it via google, not by navigating the site), and the "userid" element that's sent back with the list of elements boggled me for a while. Ok, so I was a bit harsh. I've updated the wording :-)
Yeah, I'm going to probably set up a bunch of redirects on my old server, and I have to figure out what exactly I want to keep at my old site. One thing that's really appealing is figuring out a way for "radix.twistedmatrix.com" to actually be an alias my new blogger site, without resorting to a full-on redirect or lame frame tricks. I guess I'll google through the blogger docs some more about whether they support third party domains :)
Heh, interesting thing to note: Over the night that I accidentally left my garbled-word verification off after the comment import, I got about 30 comment spams to my initial blog post. I had created the blog on the same day! Hooray for word verification ;-)
Post a Comment