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 caif2mt.zip.

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″?>
<blog>
<Blogger>
<post>
<datetime><$BlogItemDateTime$></datetime>
<id><$BlogItemNumber$></id>
</post>
</Blogger>
</blog>

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
NO ENTRY: 1
-----
COMMENT:
AUTHOR: foo
EMAIL: foo@bar.com
IP: 127.0.0.1
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.

69 Comments

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>
<id>108043259701860534</id>
</post>
– <post>
<datetime>3/23/2004 07:27:14 PM</datetime>
<id>108009883456084516</id>
</post>

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