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:
- Download the script wptoblogger.py.
- Ensure you have Python 2.5, BeautifulSoup and Google's GData Python Client.
- Create your target Blogger blog and note its ID.
- Export your Wordpress blog to an XML file (I think this is only available in version 2 and above of Wordpress).
- Run wptoblogger:python wptoblogger.py -u your_blogger_username -b your_blog_id -a author_for_posts wordpress_xml_file
- It doesn't support multiple blog authors - all posts will be marked with the author_for_posts.
- 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).
- 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.