Importing YACCS comments in Movable Type

If you have YACCS comments from a Blogger-powered blog that you would like to import into Movable Type (and if your server runs PHP, since I don’t have Perl version of the script written yet), read on…

Step one: download

Step two: read the readme in the zip file, rather than reading the instructions here.

The other steps two through five, repeated from the readme:

What does it do? : Converts an export file from YACCS into Movable Type comment import format, based on the timestamps in a file exported from Blogger.

What do I need? : You need a file saved from YACCS in CAIF (Comment Archive and Interchange Format), an XML file exported from Blogger in the format listed below, and caif2mt.php, all together in a directory with permissions that will let PHP create a new file (chmod 777, for most people), on a server that supports PHP.

What do I do? : This script assumes that you have already imported your entries from Blogger into Movable Type. Once you have done that EXPORT A BACKUP COPY. If you don’t have a backup of your Movable Type entries, don’t come crying to me when this script kills your puppy.

Once you have EXPORTED A BACKUP COPY from Movable Type, log in to YACCS, go to the control panel, click the “More >>” link for the comments you want to export, select the CAIF format and click the Export button. You should see your comments in an XML format. Save the file on your computer as ‘caif.xml’.

Next, sign in to Blogger, and create another export file like the one that you used to import your entries (999 days’ posts, convert line breaks off, no archives, MM/DD/YYYY HH:MM:SS AM|PM date/time format, change the filename to ‘blogger.xml’), but with the following template:

<?xml version=”1.0″?>

Take a look at the file in your browser as a quick check for whether it worked: in IE5+ it should look like a colorized outline, in most other browsers you’ll just need to check to be sure that at least the first and last posts are present and have the right time.

Put the three files, caif.xml, blogger.xml, and caif2mt.php, in a directory on your server, and set the permissions for the directory so that caif2mt.php can create a file (for most servers, you’ll need to chmod 777, and since it won’t be there for long it’s not much of a security risk). Point your browser to the url for caif2mt.php. If everything goes according to plan, you should see the word “Done”. If so, there should be a new file named ‘import.txt’ in the directory with caif2mt.php. Take a look at it to be sure it looks roughly like a Movable Type comment import file, something like:

DATE: 03/04/2002 09:28:43 AM
DATE: 03/04/2002 20:31:19
You are so completely right. Right right right.

If it looks reasonable, move that file to your Movable Type import directory (making sure you did remember to delete the old import file that you used to import your entries), and delete the remaining files (caif.xml, blogger.xml, and caif2mt.php) and the directory, so you don’t leave a 777ed directory laying around waiting for trouble to happen.

Log in to Movable Type, import the file (import as you, since there aren’t any post authors in the import file anyway), and if Movable Type doesn’t complain about the import, rebuild your site and you should be set.


Comment by ME-L #
2004-01-20 07:43:54

Hey, thanks for this — importing 3000+ comments didn’t go too badly. I’m wondering, though, did anyone else have a problem with the export file from YACCS? Mine stripped out the time stamp from every comment. A simple search and replace added 9:00:00 AM to every comment (I don’t even report the time, so who cares), but it took me a bit to figure out what was going on. Also, some of the date/time stamps on the entries got corrupted in the YACCS export. Just a heads up for anyone else attempting this. Thanks again!

Comment by Michael Paul #
2004-04-01 07:12:15

Here is a sample of what Blogger is giving me when I export the posts. I get 2yrs of this. No text??? Is there supposed to be more??? OR is this how its supposed to be formated? Everything else is going well.

– <post>
<datetime>3/27/2004 04:09:57 PM</datetime>
– <post>
<datetime>3/23/2004 07:27:14 PM</datetime>

I thought I was going to lose all my comments till I stumbled across this post. I guess I may still loose them if this doesn’t work.
Thanks Phil

Comment by Phil Ringnalda #
2004-04-01 08:28:58

That’s all you need from the Blogger export, this time. I’m assuming you’ve already imported your posts from Blogger, so all this is doing is exporting the post ID and datetime, so that they can be matched up with your YACCS export and MT (YACCS only knows about the post ID, and MT only knows about the datetime, so you need a step between to change from one to the other).

Comment by Michael Paul #
2004-04-01 15:38:54

That is AWESOME. Worked perfectly. Thanks

Comment by Bonnie #
2004-04-27 15:59:16

Will this script work with Haloscan comments exported in CAIF format?

Comment by Phil Ringnalda #
2004-04-27 16:51:21

I’d think so, as long as Haloscan’s CAIF looks like YACCS’s CAIF (which I’d expect it would, since it’s a pretty simple format).

Comment by Rebecca #
2004-10-28 10:05:27

I’m also working on doing this with Haloscan comments. Got the caif.xml file, got the blogger.xml file, got it all on my server and get the following error from the php script: XML error: xml declaration not at start of external entity at line 2

So of course I check for the xml declaration and both are there, and both are on line 2. I’m kinda stumped what to try next, other than poring through the php. Any ideas? Thanks so much for all you do for this ever-spreading community! :-)

Comment by Chris #
2005-04-24 21:41:54

Phil, I followed your instructions to the letter for this – even though I was exporting from HaloScan not YACCS. Still, I get a CAIF formatted file which should work just fine. The following is a sample of my blogger.xml file:

<datetime>4/22/2005 03:55:00 PM</datetime>

<datetime>4/21/2005 10:50:00 AM</datetime>

<datetime>4/14/2005 11:29:00 PM</datetime>

This next snippet of code is a sample from my caif.xml file:

<?xml version=”1.0” ?>
<thread id=”109103826817050178”>
<text><![CDATA[Unfortunately in the UK the media have misused the word so often it’s become more of less a synonym for paedophile. I personally like ’Deviant’]]></text>
<text><![CDATA[Sorry, ill-typed I was talking about the word pervert]]></text>

Permissions are 777 on the folder containing the files. When I run the php file, I get this error:

XML error: junk after document element at line 6

Any idea what this is caused by? Any help you can offer would be greatly appreciated – I have searched forums and Google and have not found any solution as of yet. Much thanks, Phil!

Comment by Phil Ringnalda #
2005-04-26 00:22:12

Hrm. I think ”junk after document element” means that there’s something it doesn’t like after either the </blog> or the </comments> (or that it sees one in the middle of the file, turning the rest of it into ”junk”).

Trackback by #
2002-10-11 00:31:44

Comments are Back!

A big thanks out to Phil Ringnalda for bringing me back my old comments. I was worried that I would

2002-11-09 11:01:15

Keep yaccing

It took a lot of patience and a dash of anal retentiveness but I managed to import all of the Yaccs comments. For those of you wanting to migrate your yaccs comments to MT, Phil’s script really does the trick. Just a couple of additions:The date on you…

Trackback by fuddland #
2003-05-22 17:19:11


yowzer! in a completely irrational fit of nostalgia, brought on by the recent first anniversary of blogging, i’ve just finished…

2003-06-19 18:03:19


Gara-gara bantuin temen kemaren jadi tahu saya, ternyata ada tools dan cara untuk mindahin comment dari YACCS commenting system ke

Trackback by Jivha - the Tongue #
2003-07-12 09:54:05

Import Comments from BackBlog(or any other source) into MT

YESSSS! I did it…I FINALLY did it!!! I imported ALL 1601 comments that I had on my previous blog with Blogger into Movable Type. It took me around 6-7 hours of heavy thinking, doing, un-doing, SQL, and testing but in…

Comment by karla lopez #
2005-12-24 05:52:59

Phil, does this script works for wordpress? I wish i could import my old blog with its YACCS coments to WordPress…

Can I do this? How?

Thanx a lot.

Best reards from Brazil.

2006-02-22 15:49:15

[…] Sweet! Mark Pilgrim’s going to be paid to work on Firefox: My secret’s out: I’m now working on Firefox full-time… I am to &quo;immerse myself in the developer community via IRC, Bugzilla, and blogs" and keep an eye on upcoming features… In other words, IBM is paying me to work on Free Software and hang out in chat rooms all day. […]

2006-04-28 18:16:33

[…] This was made possible after Haloscan fixed their comment export feature so that html is no longer stripped from the comment text. The other night I looked back at some code I had pieced together based on Phil Ringnalda’s code from his post, Importing YACCS comments in Movable Type, and I was able to finish the Haloscan importer the way I had originally intended: without screen scraping! If you have any problems or suggestions, feel free to leave a comment. Enjoy. […]

Comment by ted #
2006-10-23 10:48:03

Hi…I’ve been following all y’all’s instructions, but I keep getting a blank ”import.txt” — even the permissions at 777. And I have php, because I’ve got MT. Any suggestions?

Comment by gd #
2007-04-09 11:38:22

I ran into the same problem as Ted (comment just above). I double checked permissions, files, etc. Everything seems to work… except that I keep getting a blank output file.


Sorry, the comment form is closed at this time.