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.
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.
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.
Estou querendo um desses..
One of what?
Oie to kerendo um desse resta saber como q faço isso neh!!!
Any PERL yet for us poor non-PHP folks?
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?
Phil, you really are the MAN! I can’t tell you how much I appreciate that!
Once again, you are a man among boys. Thanks, mucho gracias, merci and many other languages I don’t know.
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?
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.
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!
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!
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?
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.
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!
comentários!
”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 http://bigblockbuster.buayaism.com/import/import.txt
i’m sorry the link should be
http://bigblockbuster.buayaism.com/mt/import/import.txt
Looks like it hiccuped at least once putting in an entry date: line 7920 is ”
So do i have to any editing to the file in line 7920?
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)”
”existing entry 2498”? http://bigblockbuster.buayaism.com/archives/2498.html gives a 404, so what’s MT doing importing comments into entry 2498?
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!! :)
For the entry with ”
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…
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:
<?php
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.
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 http://www.sitehouse.net/moveabletype/caif2mt.php
The blogger.xml and the caif.xml files are in place in that directory, and permissions have been set to 777.
…James
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.
Hi,
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?
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.
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.
Thanks
phil,
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.
also, before you ask: yes, i did rebuild, and yes, i did refresh. :)
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?
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?
weird!
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.
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!
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?
Probably simpler just to do another script to import directly from the csv. I’ll try to fit it in next week.
wow thanks, that’d be excellent!
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!
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.
Wow, just did it. And I’m not even a decent programmer. Thanks.
i cant create one own commmenting system to my web page . what i will do?
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.
Loved it! Just did it for someone else and it worked like a dream! Thank you thank you thank you!
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. :)
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.