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 nick #
2002-05-15 01:09:43

man, you read my mind. i just emailed hossein about that last night. but considering how many times over i screwed up while importing my entries, i’m gonna hold of for a little while. thank you, though. i love you. if i had a uterus, i’d offer to have your baby.

Comment by Phil Ringnalda #
2002-05-15 01:44:52

My offer from somewhere a few threads back still stands: anyone who doesn’t quite want to do it all alone is welcome to post links to their CAIF and Blogger files, and I’ll run them through caif2mt and at least try to make sure it’s producing a workable import file.

Comment by Leandro #
2002-05-25 08:52:26

Estou querendo um desses..

Comment by Phil Ringnalda #
2002-05-27 19:49:29

One of what?

Comment by Kika #
2002-06-01 11:33:10

Oie to kerendo um desse resta saber como q faço isso neh!!!

Comment by Chris #
2002-06-14 19:41:58

Any PERL yet for us poor non-PHP folks?

Comment by Phil Ringnalda #
2002-06-15 07:32:59

Sure, if all you want out of it is a ”500 Internal Server Error”. I can produce that pretty consistently. Are you sure you wouldn’t rather just email me the links to your Blogger and YACCS XML files, so I can run it through the PHP version myself and send you back a link to the MT import file?

Comment by m. #
2002-06-15 23:12:29

Phil, you really are the MAN! I can’t tell you how much I appreciate that!

Comment by Chris #
2002-06-16 10:32:55

Once again, you are a man among boys. Thanks, mucho gracias, merci and many other languages I don’t know.

Comment by The One True b!X #
2002-06-26 21:45:59

Suppose the MT install already has some entries in it. And you wan to import entries and comments from the Blogger/YACCS setup into it. Does the presence of exiting posts under the MT cause a problem for this process? Does the MT blog need to not yet have any posts at all prior to doing this import process?

Comment by Phil Ringnalda #
2002-06-26 22:27:05

No problem, unless you were posting in Blogger with your left hand while you posted in MT with your right: MT imports entries based on the date/time, so it will happily merge entries posted in MT with entries imported from Blogger. Then the YACCS import just adds comments to the entries with the correct date/time (which it looked up in your second Blogger export file), so it doesn’t even notice entries that were posted through MT.

Comment by ina #
2002-07-16 11:08:58

thanks! i was wondering how to bring all the YACCS comments to MT. i was planning on (maybe) entering them one by one. sure glad i found this!

Comment by Seth Werkheiser #
2002-08-26 19:55:50

Wow, thanks soooo much! I was bummed that I was going to lose all my comments then I found this! The import went somewhat smoothly (Blogger missed some dates for some reason + some of the comments triplicated too…) and now it’s all good to go. Thanks for the good work!

Comment by Jessy #
2002-08-29 13:00:39

This is a great tool! Thank you so much for making it available…

I did everything on the instructions, and everything went fine, except I didn’t get a new file named ’import.txt’. I think it had to do with setting the permissions for the directory. I don’t know how to do that.

Can you help me out?

Comment by Phil Ringnalda #
2002-08-29 13:53:54

Depends on what you are using to create the directory. For an FTP client like WS_FTP, click the directory name, right-click, select CHMOD, and then click every single box, so that Owner, Group, and World all have Read, Write, and Execute permissions.

Comment by Anonymous #
2002-08-30 11:36:44

I have Smart Ftp. And just today used it for the first time. I found chmod and set it 777. Everything went wonderful!

Thank you sooo much!

Comment by ** Dani ** #
2002-09-12 11:19:55


Comment by jude #
2002-09-17 07:56:49

”Invalid date format ’AM’; must be ’MM/DD/YYYY HH:MM:SS AM|PM’ (AM|PM is optional)”
is the error i got when import comments!

this is my import file pls help..i’m getting alot of duplicate entries….

this is the link

Comment by jude #
2002-09-17 07:58:10
Comment by Phil Ringnalda #
2002-09-17 08:48:11

Looks like it hiccuped at least once putting in an entry date: line 7920 is ”

Comment by jude #
2002-09-17 20:19:53

So do i have to any editing to the file in line 7920?

Comment by jude #
2002-09-17 20:42:10

Hi phil, i made the changes to the date u mentioned above and now this is what happened when i tred to import again. sigh..i’m tearing my hair out..please help. thanks.

”Importing comments into existing entry 2498 (’♠ Guys!! Do not, I’)
Invalid date format ’’; must be ’MM/DD/YYYY HH:MM:SS AM|PM’ (AM|PM is optional)”

Comment by Phil Ringnalda #
2002-09-17 21:10:18

”existing entry 2498”? gives a 404, so what’s MT doing importing comments into entry 2498?

Comment by jude #
2002-09-18 01:10:23

it’s actually referring to my Jan 10 2002 4:53 pm entry in my jan archives.. while importing in MT, it could import all the comments before Jan 10 but once it reaches Jan 10 it will immediately prompt the above error… the ”Guys!! Do not, I” refers to the subject header of entry. pls advise..i know i’ve been asking a lot…but u are the only person whom i can look for. Thank u for all yr help!! :)

Comment by Phil Ringnalda #
2002-09-18 09:48:56

For the entry with ”

Comment by Lisa #
2002-09-27 02:46:21

Hi Phil,

I’m a little confused – ok, a lot confused – nothing new there. My server runs PHP (I think), but MT’s not using it (I don’t think). How do I know?

Not sure what I’m supposed to do…

Comment by Phil Ringnalda #
2002-09-27 07:26:34

MT doesn’t need to use PHP for this to work, since you are just using PHP to make it easier for you to get your YACCS comments into a (plain text) format that MT can import. How can you find out if your server runs PHP? Easiest way is to save:

echo phpinfo();

as a file on your server named test.php, and then load the page in your browser. If you get anything other than those three lines displayed as text, then you’ve got PHP.

Comment by James Bow #
2002-09-30 18:27:09

It doesn’t seem to be working for me. I run the .php and the code appears on my screen (IE and Opera). Perhaps my webhost doesn’t support php?

The file can be found at

The blogger.xml and the caif.xml files are in place in that directory, and permissions have been set to 777.


Comment by Phil Ringnalda #
2002-09-30 19:30:14

My guess would be that they don’t support PHP. Some hosts used to require that your extension was something else, like .php3 or .phtml, long ago, but now I’d guess that if .php isn’t interpreted as PHP, they don’t. Probably worth asking, if they actually answer tech support questions, though.

Comment by Jude #
2002-10-07 21:27:17


i kept trying to import my comments over to MT but surprisingly, after a few tries, it kept hanging… i have to re-import and this caused like nearly 40(!) duplicates. I can’t get past importing more than 10 entries’ comments.. is it something wrong with me or is it becos of Different Host, the server i am under?

p.s. funnily, blogger seems to lost some entries’ comments?

Comment by Danny Dawson #
2002-10-09 16:11:10

I just moved to MT from Blogger and YACCS, but I already imported all my old Blogger posts into MT. If I use your tool and then import the resulting text file, am I going to have duplicate blog entries?

By the way, I think it’s absolutely great that you’ve done this.

Comment by Phil Ringnalda #
2002-10-09 17:09:26

Actually, you have to import your entries first, and then your comments. Well, you don’t have to, but that’s the way this script does it, so to use this you have to. The ”NO ENTRY: 1” in the import file tells MT that you are just importing comments for entries that already exist, so it doesn’t create new entries, just adds the comments to the existing entries.

Comment by Mariana #
2003-04-24 16:11:10


Comment by emmie #
2003-04-26 15:58:16


i did everything you said, and when i log into mt, the comments show there (although the ”five most recent comments” show older comments than what has been posted in the last couple days). however, on my main site no comments show on any entries :(

did i do something wrong? everything seemed to go off without a hitch just as you said it would… i imported blogger entries today and switched to mt.

Comment by emmie #
2003-04-26 16:56:41

also, before you ask: yes, i did rebuild, and yes, i did refresh. :)

Comment by Phil Ringnalda #
2003-04-26 17:35:02

I wasn’t going to say a thing about refreshing. Rebuilding, yes, but not refreshing.

Let’s see. Are comments absolutely positively open on the entries where you imported comments? What happens when you add a comment to an entry with existing invisible comments? And to an entry with no invisible comments?

Comment by emmie #
2003-04-26 20:55:43

okay, wait. apparently i was wrong. 86 out of 465 comments are successfully imported. just none of them since october for some reason. and i’m not even sure all of them are there for june to october.

is it possible that the .xml file was only partial? what happens if i do the whole thing again? am i gonna have dupe comments in some entries?


Comment by Phil Ringnalda #
2003-04-26 22:18:22

Still too many possibilities. The XML file could have been only partial (unlikely, though since it would probably end up being not-well-formed and wouldn’t work at all), which you can check by looking at whether the first and last comments in it are your first and last (or last and first, depending on which way it goes). Or the Blogger export file could be missing posts, so it couldn’t look up dates for all the entries. Or the script might have choked and only done part of them (which you can tell by looking at it, and seeing whether it has the first comment and the last comment that it ought to have). Or MT might have choked importing them.

As to whether reimporting gives you dups, I can’t remember (it’s been most of a year since I actually ran this), but you can find out safely by just picking one entry with not too many comments from the ones that did import, find that one in the import file, copy it out and import again from a file that has just that one. Less to delete that way, if it turns out it doesn’t just overwrite existing comments with the same timestamp.

Comment by emmie #
2003-04-28 06:33:18

finally figured it out!

1. the import.txt file contained an invalid date format (the date got deleted completely along with the hour, somehow). the yaccs export file and the blogger export file were both totally complete though…

2. it does make dupe comments :(

3. it appears there is no batch delete feature in mt; so i have to delete the dupe comments manually from editing each entry. see you in three years.

phil, thanks for all your help. you’re a lifesaver!

Comment by dvd #
2003-05-22 16:47:54

how annoying: since october 2002, yaccs only exports comments from the last 3 months in caif format. to export _all_ comments you have to export as a csv file.

would you know how to get from the csv to a caif so i can then use your routine?

Comment by Phil Ringnalda #
2003-05-23 08:01:44

Probably simpler just to do another script to import directly from the csv. I’ll try to fit it in next week.

Comment by dvd #
2003-05-23 15:58:19

wow thanks, that’d be excellent!

Comment by dvd #
2003-05-24 18:02:05

there may be no need — i emailed hossein at yaccs to ask if he had any plans to reinstate the option to export all comments to caif.

lo-and-behold, he reinstated the option. i just successfully imported all my comments with your script — thanks! and thanks hossein!

Comment by Phil Ringnalda #
2003-05-27 11:03:54

Ah, Hossein’s the man. I worked out a whole justification for how CSV is lighter, easier to parse, and makes more sense over the weekend, but I’m just as happy not to have to use it.

Comment by PS #
2003-06-17 22:05:20

Wow, just did it. And I’m not even a decent programmer. Thanks.

Comment by hamed #
2003-07-21 01:02:53

i cant create one own commmenting system to my web page . what i will do?

Comment by Tobias #
2003-08-01 20:15:57

Hey, thanks so much for this script. It took ages of search and replace to build the CAIF.xml file by hand from an html output of all my comments but now it’s done! THANKS.

Comment by eve #
2003-09-20 12:45:01

Loved it! Just did it for someone else and it worked like a dream! Thank you thank you thank you!

Comment by Anonymous #
2003-11-20 13:55:13

First I must thank you for the help.It worked for me.Second is I wanted to ask you if can share how to make name and email Id optional as you did here on this comment. :)

Comment by Phil Ringnalda #
2003-11-20 14:34:43

Very nice: bonus points for amusing comment spam. You don’t actually get to keep your keywords or your link, but still, points for effort.

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.