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.
13 comments:
you forgot that this script depends on functools to work (i'm not sure what it is, anyway... just googled and installed it).
I'm trying to make it work now, but it gives me some error 500, internal server error. Any ideas of what might be happening?
Hello and thank you for this information. I downloaded all of the stuff mentioned and tried to run the command line as you stated from the pyton25 directory. I put the XML file from wordpress, and the wptoblogger.py in that same directory. I also obviously ran the pyton MSI file first. My problem is that the command line is returning errors. I am thinking that the process is not finding the "soup" and "gdata" stuff I downloaded. When I try to run the command line it does ask for my blogger password, then I get an error: file "wptoblogger.py line 237 in module "main", File wptoblogger.py line 233 in Main, and then pretty much the same with other detail in line 193 and then line 86, the last one where is say No module named gdata. So I think I have all the parts but as I am not a programmer or code write, I'm having some difficulties. I am desparate to transfer my WP to Blogger without cutting and pasting every article. If you could help, I would most appreciate it. My name is Ron and my email is rscaron@gmail.com . Thank you so much
tatooka: Sorry I should have said Python 2.5 (or later) was a requirement. functools comes included from 2.5 onwards.
Not sure about your 500 error - you may have gone over your Blogger post limit and have to wait a day.
made in maine: Yes it looks like you don't have gdata on the "Python path".
To install gdata correctly you need to unzip it and then run "python setup.py install" from the gdata directory.
For BeautifulSoup you can follow the same process or just download the single-file version and put that in the directory you run wptoblogger from.
http://code.google.com/p/gdata-python-client/
site is down, perpetually..error 500 for so long...
is this tutorial and this gdata-python-client/ still working?
pls. i need to move soon my wordpress.org blog as i have no money for hosting. thank you
Boy: Which site are you referring to? http://code.google.com/p/gdata-python-client/ (over which I have no control) seems to be running fine to me.
I installed the dependences and ran your script for a single test-post. The post did not show up on my newly created blogger account.
Should I tweak any blogger setting to permit this API use ?
thanks,
Santhosh: Did you get any error messages? I don't think you have to enable access within Blogger. It's possible something has changed though - it's a while since I tested it.
Hello, I just tried to move a friends blog for her. I got the following error (buried in the output from the commandline, returns a server 500 error, with this as the body:)
http://phroughy.com/temp/error.html
i have tried the following:
python wptoblogger.py -u brittanyleanns@gmail.com -b 6211623402151954686 -a Brittany xmlfile.xml
i also tried 'brittanyleann' as the blog id (the blog is posted at http://brittanyleann.blogspot.com/) , but it did the same thing.
any thoughts?
~Michael
Michael: The Blogger error page isn't very informative so I'm not sure why this isn't working.
It could be that Blogger was having problems when you attempted it or the Blogger API may have changed since I wrote this script.
I've just seen that Blogger now have an import facility available under settings in the beta version of their dashboard.
This may not, however, take the Wordpress format directly.
After a couple hours of searching, I found this tool which worked for transferring my blog posts from a Wordpress blog to a Blogger one.
http://linuxlore.blogspot.com/2007/09/livejournal-to-blogger-or-blogger-to.html
Hope someone else finds this useful.
Thank you ANON!!!
I need someone's help to move my posts from wodpress to blogger. I have already got the export file but it can't be converted.
I don't know much about python and other stuff which technical. I need your help if you can convert my wordpress file to blogger.
The file is attached in this e-mail and its is Farsi language that contain all my writing for 6 years.
Let me know if you can help me with that.
thanks
nasim
Post a Comment