LiveJournal to WordPress
I have over a year's worth of entries sitting in my LiveJournal account that I had been meaning to bring over onto kemitix.net. But I didn't want to loose all the comments that had been made and become what I felt was such an integral part of that journal. The current LJ migration tool with {WordPress} works with files generated by the LJ site's export tool. That doesn't include the comments in that export. So I held of on the transfer.
I've found the solution to the first part of that problem. A script that can pull all the posts and comments out of my LJ account and output it as XML. This evening I have finished a {Perl} program to read that XML and put the posts, together with all the comments, neatly threaded, into WordPress.
So how did I do it?
I had to modify the program that extracts the data from the LiveJournal servers. The original is available from LJ themselves. The only change I made to it was adding the sleep 60; so that the LJ servers wouldn't ban me for thrashing their server with repeated queries. Don't worry about the script taking forever to run, it pulls down something like 500 posts/comments a minute at this rate.
Run this script twice. Once to download (sync) the data from your LJ account, and a second time to export it as XML.
Sync:
$ perl jbackup-export.pl --user=kemitix --password=.... --sync --comments
Export:
$ perl jbackup-export.pl --user=kemitix --dump=xml --comments > kemitix.lj.xml
Now WordPress, as it comes out of the tin, doesn't support threaded comments. So I had to add that feature using the instructions provided by Mark.
Download the import tool. (GPL)
Things to change are obviously your database authentication details, the name of the XML file and the author id to add the posts as. You can get the author id from the admin users page. You will need to create a category specifically for all the LJ posts and set the $wp_category hidden in the middle to that category's id.
Look for the following tags and replace them: __DB_HOST__, __DB_NAME__, __USERNAME__, __PASSWORD__, __XML_FILE__ and __LJ_CATEGORY__. You might need to change the table* values if your table prefix isn't 'wordpress'.
You will notice right at the bottom that there is a reference to 'allowmask'. See the LJ Backup/Export tool for more information of it. I specifically didn't want to import a specific set of posts that I had filtered on LJ, so I figured out the relevant value for allowmask, and skipped any that match. I also didn't want to include any private posts I had made either. Look for the line that begins 'next if ...', and edit or delete it as appropriate for your own needs.