Importing dotcomments in Movable Type

How to import your dotcomments comments from a Blogger-powered blog into Movable Type, in roughly seventeen moderately easy steps…

(Essentially the same as YACCS to Movable Type, so if you’ve seen that, there’s no point in reading further unless you actually plan on using it.)

Step one: download dc2mt.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 the comments in a dotcomments directory into Movable Type comment import format, based on the timestamps in a file exported from Blogger.

What do I need? : You need your dotcomments files, and an XML file exported from Blogger in the format listed below and dc2mt.php both in the directory above the comments directory (that is, in the same directory with comments.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, 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 blogger.xml and dc2mt.php in the directory with comments.php, one directory above the comments directory. Point your browser to the url for dc2mt.php. If everything goes according to plan, you should see the word “Done”. If you have some comments for posts that you’ve deleted from Blogger, you’ll see them listed (as “Unable to find 6834732 in index”) first. If it worked, there should be a new file in your comments directory named ‘comment_import.txt’. 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 blogger.xml and dc2mt.php, just to keep them out of trouble.

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.

28 Comments

Comment by Shannon #
2002-05-18 22:43:48

Psst. I know you’re online. I see your playlist moving. I need your mad skillz for a moment, if’n yer not too busy. Pretty please with sugar-coated rock star on top?

 
Comment by Row #
2002-05-19 18:17:41

I just did this manually, about a week ago, and what a pain! It was only on a tiny blog of 10 or so entries (50ish comments)and it took forever.

So glad someone has figured out a way to do this; maybe I’ll import my hundreds of entries to my own blog now.

Thankyou!

 
Comment by josh #
2002-05-21 16:09:31

This is great — thanks. If anyone’s interested in how to do it in Greymatter, I posted details on the MT support board.

 
Comment by Henry #
2002-05-22 12:50:00

How about Snor Comments 2 import to Movable type? :P

 
Comment by James #
2002-06-11 21:05:06

Er, what if it doesn’t say ”Done”? what if it says ”Can’t open output file”?

 
Comment by Phil Ringnalda #
2002-06-11 21:25:01

Then you must either have dc2mt.php in the wrong place (it should be in the same directory as comments.php, one directory up from the comments directory that contains the actual XXXXXX.comment files), or PHP doesn’t have permission to create files in your comments directory (though it must, or dotcomments couldn’t create comments – but chmod it 777 just in case), or… something I’m not thinking of.

 
Comment by Rob #
2002-07-12 08:21:08

Blah. This won’t work on my host’s server, since they don’t have the XML support installed for PHP. Guess I’ll have to find another solution or do it manually. Very cool, though.

 
Comment by Phil Ringnalda #
2002-07-12 14:58:26

Hard to imagine why they would leave out XML. Lamers.

Anyway, although it wouldn’t be impossible to rewrite it to not use XML (I just used it because I was doing some other PHP/XML stuff at the time, so I had it on the brain), why don’t you just give me a url for your Blogger XML file and for your dotcomments directory, and I’ll just either copy them over to my server or tweak the script enough to let it take files from a remote host, and then I’ll give you back a url for your MT import file. I still haven’t got to do enough of these to feel like it’s thoroughly tested, so I’d be happy to have another set to do.

 
Comment by Phil Ringnalda #
2002-07-13 20:47:55

Oops, forgot that the script has to be on the same server as the comments, so it can use readdir() to read the comment files without knowing the filenames. So instead I added an alternate script, dc2mtnoxml.php, to the zip file. It’s not very fully tested yet, so be sure to look at the file it produces to be sure it makes sense, and has the right comments associated with the right date/time (at least for the first and last comments) before you import it in MT.

 
Comment by Phil Ulrich #
2002-07-15 08:31:15

I was wondering….is it possible to do this if we switched from Blogger, say, last November, and therefore no longer have access to the old entries? :)

 
Comment by Phil Ringnalda #
2002-07-15 14:46:10

You deleted the Blogger blog? That’ll make it tough. Too bad neither one of us is on Ev’s good side right now: things he’s said in passing make me think that deleting a blog only marks it as deleted, rather than actually deleting it, but I don’t think we’ll persuade him to undelete even if it is possible.

Do you have anything, like copies of old archive files, that has both the post date/time and the item id numbers? We could hack together a script to parse them out if you do, but otherwise it’s going to be hard manual labor: redo the conversion script so that it writes the import file with a blank date for the post that the comments go with, and then go through it by hand, figuring out what post they must refer to, and then looking up the date for that post in Movable Type. Bleah. Maybe we could scrape it out of web.archive.org?

 
Comment by Phil Ulrich #
2002-07-16 15:02:05

web.archive.org barely ever touches my site, and I have no idea why. I don’t think it likes .htaccess files at all. Blah. And no, I don’t have anything at all as far as old Blogger archives go: I imported everything into MT when I adopted it, and then deleted the old archives as soon as I pulled the dotComments popup script out.

 
Comment by Jake #
2002-08-14 07:24:41

Should this work with a mysql backend? Because it doesn’t seem to for me… Unless I’m doing something wrong.

 
Comment by Jake #
2002-08-14 08:02:18

Never mind. I’m an idiot.

 
Comment by ethan #
2002-08-17 21:46:54

must the import file be in ascii or binary format?

 
Comment by ethan #
2002-08-17 21:50:28

sorry for the double post..i uploaded the file in ascii format and when i tried to import,
this is the error prompted to me.
”Invalid date format ’AM’; must be ’MM/DD/YYYY HH:MM:SS AM|PM’ (AM|PM is optional)”
what can i do? pls help thanks.

 
Comment by Phil Ringnalda #
2002-08-18 18:17:57

Best thing to do would be to post a link to your import file, so I can look at it and be sure, but offhand that sounds like you have at least one, if not all, your dates with nothing but ’AM’ for the date.

 
Comment by grid #
2002-09-26 09:45:05

Everything worked really great until I ran the script (tried both with xml and without) my comment_import.txt file has empty author and comment fields, and the dates are all screwed up too. (Most of the dates are all the same, 12/31/1969 10:00:00)

Do you have any idea what could have gone wrong?

Thank you so much for any help you might be able to provide.

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

I’d have to see more detail to know, but that sounds like the script isn’t reading the dotcomments files, or is reading other things that aren’t dotcomments files. It expects to find the dotcomments files in a subdirectory of the directory where it’s running, named comments, and it expects to find nothing else in that directory.

 
Comment by grid #
2002-09-26 12:59:47

Hmmm. I did have a test entry in the directory, and I deleted that, but still got the same results.

http://www.livingtech.net/blog/comments/

 
Comment by Phil Ringnalda #
2002-09-26 14:31:51

Oh.

The comments in the XXXXX.comment files need to be in the format that dotcomments uses, e.g.:

1014637185[+]foo[+]foo@baz.net[+]Ive lost your email address :([+]http://www.baz.net/index2.html[+]61.9.136.42

The script is splitting lines by the [+] and looking for data in a particular format and order between those, so any other format isn’t going to work.

Where did those comment files come from?

 
Comment by grid #
2002-09-26 23:19:19

ARG! I see now what you mean. I guess I thought I was using dotcomments…

I think I got the script from a friend.

It’s going to be a big project to import them by hand… I don’t know if it’s worth it…

thanks anyway though.

 
Comment by Ryan #
2002-10-02 11:50:08

Just wanted to thank you for having these scripts (and instructions) available… I finally switched over one of my last Blogger/dotcomments-powered blogs to MT and your script made it much easier (though it did botch a few of the datestamps on the entries, I fixed those by hand).

 
Comment by brutalside #
2003-03-01 12:26:42

nice

 
Comment by pero #
2003-09-07 21:30:39

I will be relocating to MT in the near future – and I am grateful to have found this — one of the reasons I had not done it yet was because I didn’t want to lose my comments.

 
Comment by Kate Nepveu #
2005-06-30 11:33:29

Hi Phil! Been a while since the days of the Blogger forums. I have no idea if you’re still getting comment notifications on this old post, but–

I am three years behind you in switching from Blogger to Movable Type. I had great hopes when I found this script, because while I don’t use dotcomments, the comment system I do use stores comments in a similar text file, and I thought I could hack the file to work with your script.

Alas not, since dotcomments uses a Unix timestamp and blogkomm doesn’t. Here’s what a line of blogkomm’s comment file looks like:

111966385500607739 | 2005-06-27 | 11:23am | name | email | website | comment with html tags

Some of the older entries have apostrophes preceded by slashes, like this: ”it’s”

So here are my questions for you:

(1) How long would it take you, or someone else who knows PHP (I don’t, at all), to whip up a script equivalent to the dotcomments one?

(2) I’d be willing to compensate you, or someone else who knows PHP, for the development of the script, since I don’t think a lot of other people are going to be moving from blogkomm to MT. Are you interested, and what sounds fair to you?

You can e-mail me if you like.

 
Comment by Scott #
2005-07-07 13:41:47

I want to do the same thing Kate is trying to do, except that I’d like to export my Blogkomm comments into WordPress.

Someone wrote a script to import Haloscan comments into WordPress, so I figured out that I could manually cut and paste the Blogkoms comments into an XML file (which is what Haloscan creates as an export file), but I hate to do that for 400+ comments.

 
Comment by David #
2006-02-09 14:33:52

Any ideas how to import dotcomments to WordPress?

 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <del datetime="" cite=""> <dd> <dl> <dt> <em> <i> <ins datetime="" cite=""> <kbd> <li> <ol> <p> <pre> <q cite=""> <samp> <strong> <sub> <sup> <ul> in your comment.