WordPress to Blogger

Oct 11, 2007

I recently decided to switch my blog from Wordpress to Blogger. Not because I think Blogger is better but because I wanted to avoid maintaining my own instance of Wordpress and Blogger would host my blog on my domain for free.

To copy the posts across I wrote a small Python script which takes a file of exported Wordpress posts and uses the Blogger Data API to upload them to Blogger.

If you want to do this yourself, you will need to:

  1. Download the script wptoblogger.py.
  2. Ensure you have Python 2.5, BeautifulSoup and Google's GData Python Client.
  3. Create your target Blogger blog and note its ID.
  4. Export your Wordpress blog to an XML file (I think this is only available in version 2 and above of Wordpress).
  5. Run wptoblogger:
    python wptoblogger.py -u your_blogger_username -b your_blog_id -a author_for_posts wordpress_xml_file
There are a few limitations though...
  1. It doesn't support multiple blog authors - all posts will be marked with the author_for_posts.
  2. A limitation with the Blogger API means that comment authors can't be set (they always appear as the blog author). As a workaround, I prefix each comment with a "Comment from..." line (see the existing comments on this blog).
  3. Blogger impose a limit on the number of posts you can create via the API in a certain time period. So if you have a lot of posts to transfer you may need to modify the script to post them in batches over a number of days.