Importing Haloscan comments into WordPress (v2.3 and up) from Blogger

Note: Even though I originally wrote this for WordPress v2.3, it continues to work for all versions of WordPress through v2.9.x.

Background

WordPress logoWho knew that when I migrated my Blogger blog to WordPress way back when, I’d still be supporting a hacked together Haloscan importer 3 years later!

Awhile back, I don’t remember if it was during WordPress 2.2 or 2.3, the folks at Google revamped Blogger, which meant the old Blogger importer no longer worked. So the heroic coders that do the heavy lifting for WordPress set out to write the-Blogger-importer-to-end-all-Blogger-importers, this time using Blogger’s feed-based “API”.

The problem for you classic Blogger folk with Haloscan comments is that the only way to link your Haloscan comments to their post is via Blogger’s postID. Which is apparently not accessible in the feed API. Grrr. Which meant my previous hack for associating the postID with the newly imported WordPress post no longer worked.

Last night, I finally went back to the drawing board and came up with a new solution. I’ve tested it successfully on two different blogs.

Step 1: Import your Blogger blog

Nothing to see here. Just follow the instructions in WordPress under Manage > Import.

Note: Apparently the Blogger importer built into WordPress doesn’t play well with self-hosted (aka FTP-published, R.I.P.) Blogger blogs. If you run into trouble running the Blogger importer, try first converting your Blogger blog to Blogspot-hosted with a throwaway subdomain, solely for the sake of doing the import.

Step 2: Run Get Blogger postIDs

I wrote a new utility plugin called Get Blogger postIDs that loops through every Blogger-imported post, fetches the old Blogger post, and grabs the postID. In order for this to work, the old Blogger blog must still be web-accessible.

In order for the plugin to find the all-important postID, your Blogger template needs to have Quick Edit links. If it’s a newer, stock template it probably does. If it’s an older or custom template, you may have to add <$BlogItemControl$> to your Blogger template and republish. View source on a published permalink page and search for postID= to find out.

Then follow these instructions:

  1. Download and unzip wp-get-blogger-post-ids-2.0.zip (v2.0)
  2. Upload wp-get-blogger-post-ids.php to /path/to/wordpress/wp-content/plugins/
  3. Activate the plugin (don’t forget!)
  4. Goto Manage > Get Blogger postIDs
  5. Enter the domain name of your blog (without the http:// or trailing slash). This is going to look like: www.myblogrules.com or myblogrules.blogspot.com
  6. If you have a blogspot.com domain, you can skip the second text box. If you self-host your blogger blog, use the second text box to enter the URL path after the domain, but before the /yyyy/mm/permalink.html, but only if one exists. Common paths include weblog, blogger, and blog. Leave the path blank if there is none.
  7. Click the “Import Blogger postIDs” button

The plugin will print out every post permalink and the Blogger postID it finds. It may take some time to run, depending on the speed of your internet connection and the number of imported posts. Be patient. If something goes wrong, or if you don’t get the domain and path right the first time, don’t worry, you can safely rerun this plugin. It will print “Done!” at the bottom when it’s complete. As always, if you have any problems, leave a comment here.

Thanks to Mike Conover for v2.0 of wp-get-blogger-post-ids.php. It has better feedback messages and a mechanism to specify importing the ids for X posts at a time (useful if your webhost doesn’t like long running php scripts).

Step 3: Run the new import-haloscan.php script

The same prerequisite applies: only “premium” customers have access to Haloscan’s export comments feature. Bah! The only way to get around this limitation and access your comments for export is by donating $12 to Haloscan.

  1. Download and unzip import-haloscan-3.1.zip (v3.1)
  2. Upload import-haloscan.php to /path/to/wordpress/wp-admin/
  3. log in to Haloscan
  4. go to Manage Comments > Export
  5. If you made your $12 donation, there will be an export link for every thousand comments you have. Clicking one of the export links will prompt you to save the file as “export.xml”. If there is more than one link (i.e. if you have more than 1000 comments), rename the first file to export1.xml, the second file to export2.xml, and so on. Save the files to your desktop and upload them to /path/to/wordpress/
  6. In your web browser, go to http://example.com/wordpress/wp-admin/import-haloscan.php replacing example.com/wordpress with the domain name and path to your WordPress install
  7. Click OK at the bottom of the page to import your Haloscan comments

If anything goes wrong, my WordPress Suicide plugin is very handy for deleting all the imported comments and starting over again, without having to reinstall WordPress. Good luck!

Appendix: Importing Haloscan Comments into WordPress from a WordPress Blog

Once in a blue moon, someone leaves a comment and says they actually embedded Haloscan comments into their WordPress blog—usually because they were using Haloscan with a Blogger blog back in the day, and decided to leave the comments in Haloscan. If you find yourself in that boat, fear not. Just make the following modification to import-haloscan.php using a text editor (e.g. Notepad in Windows, TextEdit in Mac OS X, gedit in Linux) and follow the instructions in Step 3.

Replace lines 77-81:

$meta_records = $wpdb->get_results("select * from $wpdb->postmeta where meta_key = 'blogger_id'");

foreach ($meta_records as $meta_record) {
  $blogger_to_wordpress[$meta_record->meta_value] = $meta_record->post_id;
}

With the following:

$meta_records = $wpdb->get_results("select * from $wpdb->posts");

foreach ($meta_records as $meta_record) {
  $blogger_to_wordpress[$meta_record->ID] = $meta_record->ID;
}

Feel free to if you found this useful.

102 Comments

I’ve just attempted this using your new script, to import comments into a WordPress blog that I converted from iBlog (using Agitprop). It gave me this error message:
Haloscan to WordPress

The importer is running…
XML error: not well-formed (invalid token) at line 9192

What next?

Thanks!

Well Tom, it means there’s a bad character or something on line 9192 of your export.xml file. Best option is to fire up your favorite text editor, open the file, and see if you can’t find and delete the bad character.

Hi Justin,
Everything has worked great so far, except for when I get to the very last step — running the import-haloscan.php script. When I go to the webpage (http://www.tommyandbrea.com/wordpress/wp-admin/import-haloscan.php) I get a HTTP 500 error. Can you help me? Thanks so much!

Nevermind, Justin — I figured out what I was doing wrong. Your plugin ROCKS!!! :) Thanks so much!

Justin, I’ve used several of your other tools without fail, but I can’t get this one to work for anything. When it gets to the final step it says “0 comments imported. Done!” I’ve tried it in different browsers with the same result.

The original blog that I’m trying to import from is http://www.mooreover.com/blogger.php (but I switch to New Blogger and republish to http://www.blogworthy.com whenever I need to import or export). Any ideas?

Jesse, did the “Get Blogger postIDs” plugin run successfully? You can check by looking at the custom fields for one of your Blogger imported posts to see if there’s a postID entry alongside the old post permalink entry.

A friend of mine was able to do it by adding some snippets of code. Thanks the tool though – saved over four years of comments for me!

Hmm for some reason I seem to be having the same problem as Jesse – There are no “postid” custom fields in the imported posts after running wp_get_blogger_ids (although it goes through all the posts perfectly)

Kev, hmm, I’m probably going to need more info to help you troubleshoot. Like the URLs of your current blog and your Blogger blog to be imported. Feel free to shoot me an email if you’d like to troubleshoot over IM.

matt

What was confusing was the Plugin part where you download the Get Blogger postIDs.

* upload the plugin file Get Blogger postIDs into your wp-content/plugins directory

I didn’t know i was supposed to put that file in that directory, since i am a wordpress newbie, so that little extra hint would have helped, but i am still greatful for your help justin. Thanks!

Also, it would have helped if i could have landed on this webpage FIRST for wordpress 2.3 and not the older 1.5 and 2 versions. unfortunately, when i googled how to import haloscan to wordpress, it landed on the older page first. Well anyway, after several hours of searching i found it.

matt

JUSTIN’S WP COMMENT IMPORT FOR DUMMIES.

STEP 1: import blogger blog
STEP 2: DOWNLOAD GET BLOGGER POSTIDS AND UPLOAD TO wp-content/plugins directory.
STEP 3: SIGN IN TO WORDPRESS
STEP 4: CLICK ON PLUGIN LINK
STEP 5: ACTIVATE GET BLOGGER POSTIDS
STEP 6: WAIT FOR IT TO SAY DONE
STEP 7: SIGN IN TO HALOSCAN
STEP 8: MANAGE COMMENTS
STEP 9: EXPORT COMMENTS
(pay 12 bucks to haloscan to upgrade account if necessary)
STEP 10: DOWNLOAD EXPORT.XML FILE FROM HALOSCAN
STEP 11: UPLOAD EXPORT.XML FILE TO YOUR MAIN WORDPRESS DIRECTORY WHERE ALL YOUR WP FILES ARE LOCATED. (/wordpress/ or maybe /blog/)
STEP 12: GO TO http://example.com/wordpress/wp-admin/import-haloscan.php
(replace above example w/ your information)
STEP 13: CLICK GO
STEP 14: PRAY TO GOD
STEP 15: if it does not work, ask questions here i guess?

Matt, thanks for your comments and suggestions. I’ve rewritten the “Step 2: Run Get Blogger postIDs” with more explicit instructions.

Okay, I’ve got everything else correct…I just can’t seem to figure out where to put the export file. Sigh. Any suggestions?

Scratch that – now I figured out where to put export. Now I’m having the same problem as Jesse. All my post IDs are correct, but the comment importer is still saying “Done. 0 comments imported.” Any advice?

Feel free to shoot me an email, maybe we can do some troubleshooting.

The importer throws this error when I run it:

XML error: not well-formed (invalid token) at line 8461

I have 9 export files from Haloscan, named as you suggested. Is the error in one of them?

Ok, now I got it working more or less, but now I get a fatal error saying that the plugin exceeds the 30 secs run-time for plugins.

Ok, NOW I got it (sorry for all the comments!).
If one has a lot of comments, say 9 export files or more, run them one at a time.
In step 5.3 you only upload one file at a time, for instance export1. Once they have been imported, remove the export file and upload export2, run the script, remove the file and so on. Otherwise you get a fatal error.

Thank you, Justin – you saved my 8500 comments :D

FANTASTIC!! Thanks so much for this! You might want to include Emme’s comment below in the instructions, though. I had the same problem and uploaded ALL the export files (I had 10) instead of uploading each one then running the script, upload the next and run the script, etc. Thanks a million!!

Not sure if I’m using this correctly, but…

I’ve imported my Blogger blog (after other headaches!) and run the first stage of the conversion. It seems successful with the program listing as far as I can tell all of my posts and saying it’s got a number for each.

However… I have Haloscan active on the blog (I thought I’d use it as an intermediary before actually doing the conversion) and it’s picking up no comments from the existing HaloScan archive. On checking the links, WordPress is still using the Post_IDs from the Blogger conversion i.e. they start at 1 and work up to 955.

I had a check of the code for the “get-blogger-post-ids” and as far as I can work out, it should be getting said IDs and putting them into the post and postmeta tables? Sorry, but my PHP isn’t that great so excuse me if that’s wrong!

As such, I’d have expected the Haloscan links to work. Either way, I’ve had a browse through my WordPress DB using phpmyadmin and there seems to be no sign of the Blogger post IDs in there anywhere.

I’m using WP2.5 if this makes a difference. Any help appreciated as I have 4500 comments I’d really like to drag over!

Sorry, on further investigation it’s supposed to add a meta-tag(?) called “blogger_id” and the populate that with the ID it’s imported? Thing is, I still can’t find any reference to these using phpmyadmin. Maybe I’m looking in the wrong place :)

I could always try and adapt your script so that it updated the existing post IDs with the ones from the import…

It worked with wordpress 2.5.1!! Great thanks a lot!

When I run the importer I keep getting… I only have 1400 comments, so just two files.. any ideas?

XML error: unclosed CDATA

In the process of importing comments into WordPress. Initial checks of old posts indicates it seems to be working almost fine. Some comments are duplicated. You will forgive me if I am amazed that this kind of thing even works at all. Well done sir, very well done.

Smithers, glad to hear!

Is there any example of xml produce by haloscan?

Saja, the format is called CAIF (Comment Archive and Interchange Format) and sadly, it seems all sources for the specification are returning 404s, e.g.
http://www.tecknik.net/commenting/caif/

I don’t have a sample at the moment, but will try to dig one up from Haloscan in a bit.

Justin, thanks for the very nice job. I see it works fine for everyone, but here I’m getting this 404 Not Found Error when pushing the “Import Blogger postIDs” button. I don’t know what i’m missing, because it is really simple. I first were using a 2.6.2 version of wordpress, but now i’m using the correct 2.3 version. Could you give me a light?

Cheers for that. I had manually tweeked all my post IDs on Haloscan around 3 years ago to match my new WordPress IDs, so I needed to alter the code slightly (to ignore the blogger IDs) but it worked first time and finally I’ve got everything on WordPress.

Ryan, three cheers for old code that still works!

Haloscan let me export for free, after I wrote to them. I don’t seem to have the wp-admin in a “wordpress” folder. It’s right in public_html.

When I try to run I get an error message for line 50.

I got the script to run.I had 5 files, and I uploaded them one on a time and ran the script. For the first one I got a notice that 19 comments were transferred. For the other 4, I got a notice that 0 comments were transferred but I should still log in and have fun. :) I don’t even know where the 19 comments are.

thank you so much for this!

after years of being on blogger & using haloscan, I’m finally moving my blog over to wordpress this week. because I had so many, I had to do 100 at a time, but it worked great.

(thought I’d just go ahead & leave a comment, as it explains why I kicked you a few bucks as a donation. :)

I twittered about it, too!
thanks again & all the best
w

Thank for you for this. A couple of notes: Haloscan is currently being migrated to JS-Kit, so you cannot upgrade your account via the $12 payment. Instead, I had to contact JS-Kit support and ask them to provide the export function, which they did with commendable speed.

AND… I had to delete one comment to get around an XML parsing error.

Sarah, thanks for the update on Haloscan/JS-Kit, glad to hear it managed to work out for you. Hard to believe this still works after all these years.

First, thanks so much for sharing this. I really want to switch to wordpress but want to keep my haloscan comments.

When I run the script, I’m getting this error:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32768 bytes) in /home/naturbc6/public_html/armywiveslives/wp-includes/plugin.php on line 302

Any idea if it is my host not allowing the memory or something to fiddle with in the script?

Thank you!

Candace, yes, it sounds like your host has limited PHP’s memory limit to 32MB. Depending on who your host is, you might be able to get them to up the memory limit, if only temporarily so you can import your comments. Also, if you have multiple comment files to import, you might want to trying running the importer separately for each—in other words, put only one comment export file in /path/to/wordpress/wp-admin/ at a time, run the importer, replace the file and repeat.

You are amazing.

I’m taking it that one of my suggestions worked? If so, glad to hear it.

segacs

Hi there! I am in the process of migrating my 7-year-old blog from Blogger to WordPress and I found this page when looking for a Haloscan commenting solution. I’ve no idea if you even check this anymore, but I figured I’d try posting my question here and pray for luck.

It took me about a week but I got all the blogger IDs in for all the posts. (I had to update about 20% of them manually, since the permalinks were slightly different from the WordPress imported ones and the script couldn’t find them. Painful and tedious, but I got it working.)

Anyway, I got the last step – importing the comments – to work earlier. But since I updated all the blogger IDs, I wanted to delete all the comments and start over, so I could import all of them.

I deleted the comments – first using your WordPress suicide script, then when I had issues I tried clearing the table directly in phpmyadmin. Then I re-ran the importer. It was successful – showed me the number of comments imported.

BUT… here’s the kicker – I can’t get them to show up. They don’t display on the comments listing page in WordPress admin (it just says “no results found”, even though the correct number of comments is listed in the “displaying 1-30 of 6,500″ text, and there’s even pagination). And they don’t show up on my posts.

The first time I imported them, they displayed fine. The problem I’m having is only since I deleted them all and started over.

I’m running WordPress 2.8.6.

Any ideas?

segacs

Hmmm, never mind, I think there was a conflicting plugin messing things up. I deactivated a few of them and it seems to be okay now.

Thanks again for this great script!

segacs, glad you got everything worked out.

Andy

I have spent days trying to get this to work. Without success. I would appreciate any help as I am close to shooting myself and my computer.

I am moving my parters blog from Haloscan/Blogger to WordPress 2.8.6. Followed the instructions and it all worked fine. however I have 44 Haloscan xml files and the importer keeps on hanging after importing 300 – 500 per xml file. I’ve gone through the xml and removed some formatting that was interfeering with CDATA, but that made little difference.

When I just put in one xml file for import I get a XML error: > required at line 55 with two files, part of one is imported then it hangs.

Help.

Andy, I forget how many comments Haloscan exports per file, 1,000? So you’re saying you have 44,000 comments to import? Yikes.

It sounds like you’re either running up against a memory or execution time limitation imposed by your webhost, and/or you’ve discovered that Haloscan’s export files do not always contain clean, valid XML, requiring manual fixes.

Given the vast quantity of comments you’re trying to import, I’d suggest trying to get this working on a local dev install of WordPress, where you can arbitrarily increase the memory and execution time limits. Then you could just mysqldump the wp_comments table and import it into your production db.

Let me know if I can be of any more help.

Andy

Thank you Justin.

Haloscan xml are 1,000 each and my partner’s blog is very popular, so yes, 44,000 comments to import. Yikes indeed. I haven’t got the setup for a local install, but I could do it and try it that way.

Do you think just splitting the xml files into 500 comments or so each would be another way of getting around the memory and time limits?

Andy, honestly I don’t know. It sounds like you’re entering into uncharted territory that might require some trial and error—all of which would be a whole lot easier with a local WordPress development environment.

Malcolm Johnson

I’m transferring a blog of 1,500+ posts for a friend. All goes well with the Blogger post transfer, but things go pear shaped with the Haloscan comment import. I run the get-blogger-post-id utility, and for each and every post I get this message – “postID not found for this permalink. Please check your blogger template for this individual post (permalink).” I’m baffled as to what to do next, and would appreciate any advice I can get!

Malcolm, without the URL of the blogger blog you’re trying to import, I cannot be much help. Does the paragraph that begins “In order for the plugin to find the all-important postID…” help at all?

Thanks for the reply Justin. Whoops, yes, I forgot to provide the blog URL!

I’ll look at the template and check out the Quick Edit links. Excuse my ignorance of Blogger, but when you say ‘republish’, does this mean republishing each and every post in the blog? If it does, my friend is going to have a very busy Christmas. :-)

Malcolm, with Blogger, if you update the template, Blogger has an option to “republish” the whole blog (or at least it did back in the day). It might take a while, depending on the number of posts, usually a few minutes, but it’s not something he should have to do manually.

Justin, thanks for your advice. I’ve updated the template – but there’s no ‘republish’ option anywhere in the dashboard. Digging into the Blogger help system I discover that only FTP accounts have the ‘republish’ facility. So I’m back to square one. :-(

Malcolm, essentially what wp-get-blogger-post-ids.php is looking for is the following string in every single Blogger permalink page:

postID=1234567890

…where 1234567890 is the actual Blogger post id.

If you can update the post template to include the following, perhaps at the bottom of every post:

postID=<$BlogItemNumber$>

…then wp-get-blogger-post-ids.php should be able to associate the blogger post ids with the imported WordPress posts, so that you can match them up with your exported Haloscan comments. Hope this helps.

Justin, that did the trick! I had to edit one of the XML export files which contained an illegal character, and use the Suicide plugin a few times, but only lost a handful of comments somewhere along the way. My friend is absolutely delighted, and asks me to convey his immense gratitude for your excellent guidance. Thanks!

Malcolm, wunderbar! So glad it worked.

Justin, right now i’m helping my friend migrating her blog to wp and need to do the same stuffs. I’m confused with . On blogger template, where should i put that tag?
Thank’s alot.

Does this work with WordPress 2.9?

I get “0 comments imported.”

Wulan, you can put:

postID=<$BlogItemNumber$>

…pretty much anywhere in your template where you individual post is written out.

Jay C, yes, even though this was written for version 2.3, it should continue to work through the current version of WordPress. You need to make sure you run Get Blogger postIDs successfully before you try to import your comments.

Thanks, Justin. I’ve never used blogger. My Haloscan comments were always on my WordPress blog. Do I still need to run Get Bloggerpost IDs?

Jay, this code is specific to importing Haloscan comments that have been embedded in a Blogger blog—though it can be adapted to other purposes.

If you want to import Haloscan comments that were embedded in your WordPress blog, replace lines 77-81 of import-haloscan.php with the following:

$meta_records = $wpdb->get_results("select * from $wpdb->posts");

foreach ($meta_records as $meta_record) {
  $blogger_to_wordpress[$meta_record->ID] = $meta_record->ID;
}

It’s a bit of a quick hack, but it should get the job done. And if you do this, you do not need to run wp-get-blogger-post-ids.php. Just follow the instructions under Step 3

You are awesome, Justin! Thank you. The world is a more beautiful place for having you in it. :-D

Jay, thanks. I’m glad it worked out.

Hi Justin, thanks for your respond.

I’ve tried to put postID=”inside the tag and it didnt work.
I also put inside tag but it also didnt work. Then i changed it to <div class postID="”> and also put it inside tag but it didnt work either. :D

Can you explain why it didnt work? Sorry, i’m a new comer. :D

Thanks a bunch.

Justin,

I get “0 comments imported” as well. I have a blog on the old platform system (Old Blogger). The plugin import most of the ids, but when I tried to use import-haloscan.php I can’t import anything. What is going wrong, do you have some clue?

Thanks in advance

Ellen

Justin, thanks so much for this great resource – It’s really invaluable now that Haloscan is shutting down. I was hoping for a little help with troubleshooting: I’ve managed to get the postID=[number] to show up so that I can actually see it (see towards the bottom of this page of the old blogger blog as an example), but the script still isn’t pulling out the post IDs – even on that specific page it’s throwing the “postID not found for this permalink. Please check your blogger template for this individual post (permalink).” error.

Now I moved the blog itself some time ago (the wordpress install now sits in a different directory, if that has anything to do with it), but I can’t quite figure out why the script can’t pull the postIDs when they’re clearly there. Any ideas?

Ellen, what are you entering for the domain and the path fields? I’m hoping “www.ellenshapiro.com” and “blogstuff” respectively?

Ellen

So I’d been about 99% close to right – I’d had the domain name in correctly but I was not simply putting the folder in the archive path, I was putting in the full path starting with the www. The second I switched the archive path to just the folder, it worked perfectly. Imported all but seven of my 1400+ comments. Very impressive! Thank you again for this resource, you’ve been very, very helpful.

Glad it was such a simple fix. You’re very welcome.

Bjorn

Having an Icelandic blog, with comments in Icelandic means the special Icelandic characters are all mangled. Any chance of some kind of fix for that?

Bjorn, are they mangled in the Haloscan export file? Do you know if your WordPress DB tables have their character encoding set to Unicode? This might be better handled over email. If you could send me an email with one of your Haloscan export files attached, I’d probably be able to help more.

Thank you very much for this great code. however I have a little problem. my blog and most of my comments are written in persian and are encoded as (utf-8) but as I import them into wordpress it seems that encoding is messed up and I see a bunch of unrecognizable characters.
By the way I am runnning wordpress on xampp on my pc, I don’t know if this makes any difference or not.
I will be very thankful if you help me rescue my comments as it is the result of 8 years of blogging ant I have about 3500 comments in haloscan.

eyedeen, it sounds like you had a similar problem as Bjorn above. Do you know what character encoding your wp_comments database table is set to? If you could email me a copy of your haloscan comment export file, I might be able to do some analysis.

Bjorn, eyedeen, I just made a fix in v3.1 of the importer that should prevent it from mangling your non-Latin characters. I hope too that this does not adversely affect the Latin-character crowd. ;)

Update: I accidentally put v3.1 in the wrong spot on my webserver, causing the download to be broken. Link is fixed now.

Justin, you are a Saviour. Helped me to transfer a client’s blog comments. Can’t thank you enough.

Ravi, wonderful, glad it worked for you.

Justin,

I switched from a Blogger account to self-hosted WordPress several years ago. At the time, I imported all of my posts from Blogger, and hacked my template to display the Haloscan comments for each post.

Sometime later, I switched to using the native WordPress comment system, and disabled Haloscan commenting.

I have now downloaded the XML export of my old Haloscan comments, and would like to import them into my WP database.

I’ve not gone back into my database to make sure, but it would appear that I already have my haloscan comments tied to PostID. For example, from my comments.php template file, here’s my hack:

<a href="javascript:HaloScan('<?php the_ID(); >');" target="_self" title="Comment on <?php the_title(); ?>">

So, will your plugin run “out of the box” to import my Haloscan comments, or will I need to modify it?

Thanks in advance. Hopefully this plugin will save me having to import a few hundred comments by hand!

Chip, you’re not the first to ask about this. I’ve just updated this post with an Appendix describing what you need to do. Hope this helps.

Dang stupid things.
The mangling happened both due to character encoding and ftp-ing. I was hung up on saving the file locally as UTF-8 or Unicode, and marking the XML encoding as same (whichever I tried). I finally thought to check if the file actually transferred non-mangled. It didn’t.
The solution was saving the text file as ANSI, with the XML encoding set as UTF-8. That way everything came over fine.
Thanks for the help and thank you for the brilliant utilities.

Oh, I missed the fact you updated the importer. Didn’t need it though, worked with the old one as I just described!

Bjorn, glad to hear it all worked out, even without the update.

Awesome, Justin! I made the specified change, fixed an encoding-malformation in my XML file, and the script ran flawlessly.

Thanks for the awesome plugin!

Larry

Recently upgraded the blogger blog to WordPress self-hosted. I activated and ran the plug in but it told me that no WordPress posts had blogger permalinks. I exported my blog from blogger and converted the export XML to WXR using an online converter; that is how I got the posts into WP.
The blogger archives are in the root of the domain, and there is a blog.html file that remains of the old blog. What am I doing wrong?

Larry, in order for this to work, you need to use the Blogger importer built-in to WordPress. It ensures that certain metadata is stored along with each imported post, which is what enables the tools in this post to match them back up with their old Blogger IDs for the purpose of matching them back up with their old Haloscan comments.

I would recommend starting over and importing your Blogger content directly from WordPress, under Tools > Import. To wipe the slate clean, check out my WordPress Suicide plugin. Good luck.

Justin, thanks so much for this. Everything went as planned except when moving 8000 comments the script timed out (at 60 seconds on my server). This was easy enough to remedy by batching the comment imports.

Also, all of our posts have an extra character “>” before the titles and in the first paragraph. Any suggestion on how to avoid/remove that?

Thanks again!

Larry

Ok. There are a lot of posts, unanswered about importing blogger posts into WP. I’m on WP 2.9.1 and after giving my Google credentials, I see 0/0 posts and 0/0 comments. The only way I have been able to get posts into WP is to export the blog and run it through a WXR converter and bring it in as a WP blog.

htsh, try my WordPress SQL Executioner plugin. You can use it to write an arbitrary SQL query against your database to clean that up. For example to remove a leading > from the beginning of your post title with the SQL Executioner, run this query:

update $posts set post_title = substring(post_title, 2) where substring(post_title,1,1) = '>'

For the post content, run this:

update $posts set post_content = substring(post_content, 2) where substring(post_content,1,1) = '>'

Be careful though, and make a backup of your database first!

Larry, I’m sorry, but I do not support the built-in WordPress importer. It has worked for many people. I would check out the WordPress support forums for issues with that.

Larry, I’ve noticed (in helping folks migrate from Blogger to WordPress) that the WordPress importer can have trouble migrating blogs that are not published on Blogspot.

Meaning, if you have a blog that is published to a custom domain or FTP server, the importer may see the blog title but show 0 posts to import. Temporarily switching publishing settings to Blogspot (you can of course change them back later) seems to solve the problem.

Don’t know where you are publishing to, Larry, but if it isn’t Blogspot, try that suggestion.

Justin, you might consider adding a note to Step 1 which contains this suggestion. It’s worked for me and many other people.

Larry, Andrew, true, I’d forgotten that. This explains why the few remaining self-hosted/FTP Blogger users usually first republish their blogs on a throwaway blogspot subdomain. I’ll add a note to step 1.

Hey there. I am in a bind. My professor has requested that I take charge of migrating a multiple author blog from blogspot to wordpress. There are several conditions with which I’m dealing here…
1) there are about 5000 posts.
2) They use now JS-Kit for their former Haloscan comments (which in JS-Kit is still listed as their haloscan URL) There are about 109,000 comments all of which i have downloaded into 110 separate files all named export1….export110.xml

Now, believe me that I’ve followed your instructions literally 12 times now. Thank god for you Suicide plugin. Each time I get to the Haloscan portion I get an error, such as:

Haloscan to WordPress
The importer is running…
XML error: not well-formed (invalid token) at line 911.

Additionally, most of the posts are lining up with the correct users despite maybe a handful.

PLEASE HELP. I’m being driven nuts.

Hope all is well.

Cheers,
Jason

I guess my question is along the lines of Jason’s. Will the import script work with the exported comments from JS-Kit (Echo), since they have “swallowed up” Haloscan?

Kyle, I don’t know. Try it. If it doesn’t work, let me know.

Justin, It did not work, but I am not sure if it is because I did something wrong, or because of the new file format. I put the export.xml file in the directory where WP is installed (the directory where the WP-Admin directory is also located), and I ran the script. It did not hesitate and came back with “Done”, and 0 imported. I believe the get-blogger-post-ids portion worked, because the post ID’s are listed as blogger_id under Custom Fields. (I don’t see any extra HTML in the post code, however).

Post ID’s and comments seem to match, maybe it is just the new syntax of the export file… not using Haloscan in any text, rather they are using JS-Kit now.

Any thoughts?? I’ve got almost 7 years of comments… It would be great to get this one last step done and on my way.

One other thing. JS-Kit is dumping them all to one file. I’m not sure about total number of comments, but I did try renaming it to export1… it still did not work.

And… yet another bit of info: When running Import-Haloscan in IE, it just gives me the 0 imported, but through firefox, it gives me “XML error: not well-formed (invalid token) at line 19921 “

Kyle, you’ll need to look at the export file in a text editor, go to line 19921, and try to fix the character-encoding error. Unfortunately Haloscan/JSKit generates XML with the bozo filter on, which means you have to manually edit the export file to correct any bad character encodings that they throw in there. Try that and try again in Firefox until there are no more XML errors.

Justin,
I found and cleared the error (it was nasty :)
However, it still just says “Done” and 0 imported.
Any ideas? If it is too much trouble for you to look into, I understand. I just think there are quite a few people out there with the same problems coming up right now (with Blogger removing FTP support, and having this Haloscan/Echo buyout at nearly the same time).

If I knew what the old Haloscan export looked like, I guess I could change the item headings myself to match it and import it (I think)… I’m just losing my mind here :)

Oh, and when it does run, it immediately goes to the “Done” message. (The file is nearly 2m).

Kyle, maybe shoot me an email and attach a zipped up version of the JSKit export.

Ray

Hi Justin. Thanks so much for your efforts. Like Kyle, I’ve been looking for this solution for a while; and, like Kyle, I’m finding that there’s something up with th export.xml file that prevents your solution for working for me. I suspect there’s something tangibly different between the Js-Kit export file and the Haloscan export file. Unfortunately, I think your plugin is made for the latter, while I’m dealing with the former. Any additional insights you could offer on this issue would be greatly appreciated.

Ray, correct, the JS-Kit export is significantly different from the old Haloscan export files, and when I looked at it over email with Kyle, we discovered that it didn’t even have an obvious mechanism to tie the comments back to their original posts. So at the present, unless something has changed, this technique will not work for current JS-Kit users.

Ray

Thanks for the confirmation, Justin. I’m presently trying something new, that I do not expect to work, but what the heck. Disqus claims that it can import from js-kit, so I’ve installed Disqus and run their js-kit/echo import utility. It’s finished, but now I have to wait to see if it actually did anything. I’ll let you know if it works.

I’m in a mess now. Been trying to follow this, and the Get Post IDs plug-in could only find about half my post-ids. A lot of them were older posts, so I tried to republish my blog with a new template, hoping all posts would have IDs. Well, looking at the page source they do, I can find postID= no problem. But now the plug in can’t find ANY of the post IDs, and I think I can’t get any of my comments to import now. Any help?

Hi Justin,
I’m so glad to see a potential solution for importing my old Haloscan export files. I’ve installed and activated the “Get Blogger postIDs” plug-in, but I can’t seem to find where to run it. Your instructions say:
Go To Manage > Get Blogger postIDs
I feel silly, but I can’t find where to do this. I don’t see any option called “Manage”. Was this for a version of WordPress prior to the latest one?
Thanks!

Yep, I was silly. I found it under “Tools”.

Name

Email (optional)

Blog (optional)