This page is outdated. Please click here for the update. Comments are closed on this post.
As I have not heard anything about the solution to this problem, I wrote a script. This script is a simple but powerful 😉 script which extracts the posts and comments from RSS feeds at blogger.com.
Instructions:
Copy the script to your main WordPress directory and run it (http://your.name/blogger-beta-import.php). The options are self-explanatory. This means you can customize the category and user before importing.
Warning:
This script represents a security hazard if left on the server. Once you are finished, delete it. Don’t even rename or save a copy on the server. The script does not honor WordPress authentication and checks, but utilizes some of WordPress’ functions.
Limitations:
- No handling of images (stay on blogger server)
- Comments will have the names but not email or URL – limitation with RSS from Blogger
- Unlikely to work if you use other comment systems
- You need to enable RSS feed for comments – very important!
As for images, they will stay in blogger.com but I suggest you download them at once to your server as Blogger does not allow hot-linking (images will be blocked). You don’t have to do it one by one, you can use this plugin by Notions: Blogger Image Import. I’ve tried it and it worked well. One thing is that it depends on CURL to download images – servers without this extension will not execute the script. Let me know as I have a workaround for this, provided that your PHP version is later than 4.3.0.
Please don’t look at the code as it is written in 2 hours without so many cosmetic or improvements in efficiency. This script will work on existing WordPress installations but due to some assumptions made, it may break certain things like post counts for categories, etc. I suggest use it only on a virgin WordPress installation. However, I’ve tried it to import several different blogs and the result is awesome – it looks like multi-user blog 🙂
This code will be short-lived, I think as Blogger is finalizing their system out of Beta. One little change on their system would mean disaster for this script, and I am not sure I will have the time to give any kind of support. So, be quick and import now, while the script still works!
I have not tested this script with blogs larger than 300, if you encounter problems do let me know, maybe we can split executions.
Download the script here:
blogger-beta-import.zip (2.81KB)
blogger-beta-import-0.2.zip (3.64KB)
blogger-beta-import-0.3.zip (3.69KB)
blogger-beta-import-0.4.zip (4.86KB)
blogger-beta-import-0.5.zip (4.94KB)
Changelog:
2006-12-22:
- Added ability to add commentor URL and email since these data can’t be obtained from RSS.
- Added extra checks to terminate script if something fails. No use wasting user time to wait for a broken result.
2007-01-01:
- Bugfix: When a comment author’s name contains apostrophes it will fail to be loaded into the database. Update 0.3 fixed that – thanks to Dawn.
2007-01-11:
- Added automated checking for feed retrieval mechanism (fopen or curl). If both are not available, the script will tell you and not run 😉
- Added code for retrieval using curl.
- Added ability to make step by step imports – useful for people having bandwidth or server speed problems. Requested by Dawn.
- This script has only been tested in few sites, so if you encounter any problems do let me know.
2007-01-14:
- Bugfix: First import does not work, page have to be refreshed to make it work – thanks to Jonas.
I suggest you download the script only from this site, especially if you’re not a programmer as PHP codes are easily modifiable for malicious intent.
I will not be liable for any problems you might have with your WordPress installation. Use this script at your own risk.
Comments are welcome but I may take some time to respond as my time is limited.
How to make sure full feeds are available:
Switch to Advanced Mode and make sure your settings are like this:
Special Notes:
Thanks to Charles Wesley for his suggestions on using the CURL library.
Tested On WordPress versions:
- 2.0.5 – Working.
- 2.0.6 – Working.
- 2.0.7 – Working.
- 2.1 – Working. Thanks to Ricardo
TODO:
Import by a number of posts at a time (staged import)– done- Haloscan import support
- Mapping of categories from blogger
- Mapping of authors from blogger
- As a plugin
- Include an option to import all posts without staging
- Maintain permalinks from blogger
The script worked perfectly. Thanks for matching up the comments with the posts – the xml importer couldn’t handle that!
That’s very good news, Joe. Thanks for testing it. The script actually bangs the blogger server, looking for comments RSS for every single post. So if you have 300 posts, there will be 304 requests made (1 to check total and ID, 3 to get posts, 300 for comments!)
Thanks a lot for the script!
I’ve been trying to get it all in through the RSS import without success. After I ran your script it was done in seconds, excellent!
That worked man!!
Really cool – cheers n’ respect!
Thanks alot for the script! It worked great! I was just about to give up at the database steps from webbleyou and you showed up, like a knight in shining armour 🙂
It worked great!
I’m glad it worked out for you guys. Thanks a lot for trying it out.
Thx. Worked great!
Ady – thank you for this script/tool. I converted my blogspot blog from “old” to “new” Blogger this week and THEN realised that the importer would not work. I have not worked with php before but your script managed to transfer 222/257 of my posts, complete with comments and images. Manually working with the balance is not nearly so daunting.
Thanks so much for writing that script, it worked flawlessly!
Thank you, thank you, thank you!!! You just saved me hours and hours. I love it when technology works! (Not to mention generous coders…)
You are a GOD!!..at least in my universe. I had put off migrating my blog until someone like you came along. Now I’m out of google’s clutches…at least until my next search.
any idea why I can only import 228 out of 292 posts?
@Brenda: I am glad that the script has helped you.
@Josh, @Adam: You’re welcome
@Kathryn: Nice site
@Dawn: This may be caused by timeout or very slow connection between the server and blogger server. Or, also by the slowness of the server itself – PHP interpreter have timeouts (server dependent). Please let me know of your blogger ID. Email it to me if you don’t want to disclose. I’ll try to help if I can… however due to my own Internet connection problems I might face the same problem. It would be useful if you can remember what was the last result displayed.
I am not at liberty to disclose the blogger ID, as I am installing wordpress for a client and attempting to import an established blog at blogger.
The final line of the import said this:
Post 228 read from XML: Thursday Thirteen #8Error inserting comment.
I’ve attempted this import three times, all with the same results.
@Dawn: Well my friend, good luck. Without the feed that causes the error I can’t debug or find out what causes the error. And to get the feed I need the blogger ID to extract the feed… From the error message you provided it there must be something wrong with the comments on that particular post.
What you can do is load the imported WordPress, check for the last imported comment on the last imported post. Next compare the comments with the matching one in blogger. The next comment in blogger after the one successfully imported should be the problematic comment. Look for any unusual contents and try editing the comment on blogger before restarting import.
It would be great if you can share with me on what you found so that I can edit the script to overcome the problem that you are facing, to help future imports for others.
Do you just need the blog address?
I’m sorry, I’m not too familiar with blogger terms. I can give you the address, though. Would that help?
@Dawn: maybe my term was incorrect. I don’t need the Blogger ID but the first part of the URL XXXXXXX.blogspot.com
I just seem to forget that an ID can have different blogs. I should have said blog ID.
ah, okay, I would prefer to email that. What addy should I send that to?