Import Blogger Beta to WordPress

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:

Blogger Feed Settings

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
0 Shares

160 thoughts on “Import Blogger Beta to WordPress”

  1. I haven’t got the time to look at the script yet.. only at the comments here πŸ™

    @Stephen #126: My mistake for not understanding your question, sorry. No, that’s not a problem for many but for for some, if they want to maintain permalinks. The script will not retain Blogger permalinks but create WordPress style permalinks.

    @Andrea: I am working on converting this all to a plugin but it’s going very very very slow. Sure you can mod it to include categories, haloscan, and I’ll include it in the plugin as a next release (with credits of course!). You can see my TODO list up there… some of the users (e.g. pukkalad, Lisa) are having problems with sessions, no idea why even after looking at the output of their phpinfo(). I am thinking of putting them all to hidden post fields. I had an idea in mind – that’s why I used session.

    @stephen #130: Actually no, it’s not a shame. It’s just a missing feature for now. And even after this is supported, it’s not a fix, it’s an enhancement. The internal import method is now totally different from the old blogger. I’ve read the link you provided weeks ago but it is not applicable anymore to new blogger. I shall see whether the feeds include permalink information, and if yes you’re in luck! if not, then someone needs to either (1) thoroughly analyze how permalinks are made in Blogger, or (2) contact Google to ask for their algorithm πŸ˜‰ . Is http://www.stephennewton.com the blog you are thinking of migrating?

    Thanks all, and wish me enough energy to finish up my paid projects so that I can work on this one. πŸ˜‰

  2. Thanks again for all your hard work. You’re right I do hope to import stphennewton.com and a couple of other blogs.

    With nearly a thousand entries, fixing the URLs by hand would be impractical.

    The RSS feeds must include the orginal URL as they always have a link to the orginal post.

    If this is something you can fix, and if you get a working import for Haloscan comments too, I’d be happy to consider making a donation towards your work. Email me if that suggestion is of interest to you.

  3. @stephen: Please don’t donate if you are hoping by doing so I can do magic. However you’re right it’s very simple to migrate the permalinks along, as I see the permalinks being made available in the feed. I didn’t notice that earlier.

    @All: Thanks for those who have donated. Please also understand that the tip jar/donation function is to show appreciation on work that has been done, not as a payment mode. This blog, and the contents are for fun and pleasure so I will not take pressure from users in here otherwise it’ll become work.

    This script was originally written for my better half to import her blog, and it has served it purpose. I am continuing this only as a hobby, not as work… so please have some patience.

  4. OK, I am new to this whole wordpress thing, and have uploaded the file to my website, in the wp-content folder. I don’t understand how to run it though. I tried putting it in my plug ins folder but it doesn’t show in my wordpress dashboard. I tried cutting and pasting the link to it into my address bar, and nothing. Help! There’s no readme file for this to walk me through the use of it and I don’t understand your instructions on this post.

  5. Ady thanks for the response.

    However even with a post count of 5 I am still getting the error. I have a DSL connection so server to blogger should not be a problem.

    Not sure what to do now.

  6. Wow! That looks good! I had previously imported all my posts from the old blogger, but had my comments hidden because I was testing haloscan the day before. So, my comments didn’t get transferred. Then, they finally let me switch to the new blogger, hence my current problem. I’ve unhidden my comments and I want to try and import them over. I hope this works!

  7. I’m going to tr this now, because I was just royally burned by a marketer’s fake import script in which the new blogger import works, but embeds advertisments to his own site in every one of your posts. watch out for this guy, whatever you do, this is extremely shady and now i have to start all over again: http://downloads.ituloy-angsulong.com/blogger-beta-to-wordpress-import-error-solved-with-bb2wp.html

    i’m kind of praying this iste isn’t shady too, but we’ll see.

  8. i got so far as to hit import and then go this error twice: Safari can’t open the page β€œhttp://www.edzipco.com/blogger-beta-import.php”. The error was: β€œlost network connection” (NSURLErrorDomain:-1005) Please choose Report Bug to Apple from the Safari menu, note the error number, and describe what you did before you saw this message.

  9. i get this error when clicking next after 25 of my entries get imported…

    Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /homepages/27/d93713938/htdocs/gso/blogger-beta-import.php on line 247

    Warning: fopen(http://.blogspot.com/feeds/posts/full?alt=rss&max-results=1&start-index=200000) [function.fopen]: failed to open stream: No such file or directory in /homepages/27/d93713938/htdocs/gso/blogger-beta-import.php on line 247

    ERROR: [] Unable to extract initial data from http://.blogspot.com/feeds/posts/full?alt=rss&max-results=1&start-index=200000

  10. HI-
    This didn’t work for me at all. I don’t know much about mysql databases so that poses a problem when this is my error message. i went through refreshing, to finish the cycles, but i got an error like this each time: Post 850 read from XML: “Close Your Eyes!”
    ERROR: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘1,’2005-06-29 13:57:00′,’2005-06-29 17:57:00′,’ Error inserting post.

    Can you help?

  11. @antlered girl: LOL… he could’ve mentioned that in his post if he wants to do that. So bad. (#140)

    @gregg and everyone: Please wait for the new version to be released as a plugin, as I am looking into all these problems (see comment #138).

    Thanks.

  12. Thanks Ady. I couldn’t believe that guy. He embedded URLs like “seoasshole[dot]com” SO sketchy. Can’t wait for your plugin. I’m having a hell of a time with the really complicated plugins out there and i keep getting a mysql error using this one. Do you know when it will be ready? My poor friend’s blogger blog is suffering.

  13. Good news. The script is now a plugin. I am not releasing it yet to finish these:

    • author matching (currently being worked on by Andrea)
    • category matching (currently trying to find a blogger site with low number of post and category since post 1-10: testing is taxing my time!)

    Many people will be happy with these working update:

    • Haloscan friendly (to be used with script from justinsomnia)
    • Permalink maintained from Blogger (the name part so you need to tweak the permalink settings in WordPress)
    • Import all at once (no staging)

      Internally, these were changed:

    • Plugin code, obviously
    • No raw database calls. All database calls are done via WordPress functions
    • No session anymore. All variables are passed by means of hidden post fields

    It should be released by next Monday, hopefully. Perhaps I will release it on a new post as this post is already too long with comments and everything.

    In the meantime, for the impatient (and for those who don’t need author and category matching) you can download a beta version here: new-blogger-import-1.0-beta.zip (mdsum: 928a94ea799d74187debc2d564e9fc24)

    Please be aware that this might be broken, and if you run tests please let me know of the results. To install it copy to /wp-content/plugins directory, activate it on the Plugin page, and you will see it as a link on the Options bar.

Comments are closed.