browser icon
You are using an insecure version of your web browser. Please update your browser!
Using an outdated browser makes your computer unsafe. For a safer, faster, more enjoyable user experience, please update your browser today or try a newer browser.

Importing LiveJournal Entries to Movable Type

Posted by on July 16, 2002

DRAG AND DROP!
You should now be able to do the conversion easily by yourself, thanks to the Drag and Drop LJ into MT script published at ScriptyGoddess! Please note that I have no information about this script and I have not even tried it myself…but before contacting me to do your conversion, please try this first. Then, if you really need to, you can ask me for help. It’s faster when you do it yourself, too – I promise!

So you’d like to import all your LiveJournal entries into Movable Type. It’s not as hard as it looks, but there are a few things you need first.

  • Whether you’re doing this on your own machine or someone else’s, you need to be able to work with Perl. In most cases, you will need shell access to your server to mess with it.
  • dburr’s lj2mt script. This is the program that does the dirty work. (Just in case his goes down, I’ve saved a mirror of the script.) Make sure you remove “.txt” from the end before attempting to work with it!
  • You will need the XML::Node and Date::Parse modules installed; if they’re not present you need the ability to install modules (both permissions and know-how).
  • Note: The XML::Node module requires both XML::Parser and XML::Parser::Expat, both of which are available from CPAN.

Once you’ve got everything in place, you’re ready to export your LiveJournal entries. This should be done in Internet Explorer if at all possible, due to apparent problems with Netscape’s parsing of line breaks.

  • Log in and go to the Export Journal page.
  • Export what: Journal Entries. Currently this is the only option.
  • Select month: Fill it in yourself. You do have to do this month by month for every month you’ve been keeping a LiveJournal.
  • Format: XML. Won’t work any other way.
  • Header: Checked. I don’t think this affects anything if you’re exporting to XML, but I’ve always left it checked and it doesn’t hurt anything.
  • Encoding: Unicode (UTF-8). It will break if you set it to anything else. This may result in foreign or accented characters being transformed into something else, but it’s easy enough to correct using MT’s search-and-replace function.
  • Fields: Event Time, Subject, Event. You can add others if you like, but these are the only ones that will be imported into MT. If you download the script from my server (see above), you can also export the mood and music information, which is appended to the entry in MT.
  • Proceed, and then go to File > Save As… to keep the results. You must save it with a “.xml” extension; saving it as text and then just changing the extension to “.xml” won’t work. Call the file whatever you like, “2002-02.xml” or “july01.xml” or something useful like that.

The next step is do actually do the conversion.

  • Put the lj2mt.pl script and all of your XML files into the same directory.
  • To run the script, type lj2mt.pl july01.xml mt-name > july01.mt at the command line – “mt-name” should be replaced by your login name for Movable Type.
  • You will see it process each entry; on a fast computer they will fly by too quickly to read but you’ll be able to tell it’s working. If it doesn’t process each entry in this way, something is wrong.
  • Repeat the command for each month you’ve exported from LiveJournal, changing it to lj2mt.pl aug01.xml mt-name > aug01.mt as appropriate.

You’ll now have a collection of “.mt” files. The Movable Type manual contains instructions on importing entries, but I’ll mention a few things here, along with a few final notes.

  • It’s probably a good idea to do a test with just one of your “.mt” files first. Once those entries have been imported successfully, delete that file from the import directory, and put all the rest in there. It’s fine to do a whole bunch all at once.
  • After everything is finished and you’re happy, go ahead and delete the “.xml” and “.mt” files, you won’t need them anymore.
  • Note that MT has no support for private or friends-only entries. If you import ‘em, we’ll see ‘em. The only way around this is to set those entries to “Draft” after you’ve imported them.
  • There is currently no way to export LiveJournal memories. You will have to establish MT categories for each Memories category, and set it all manually.

Rebuild, and you’re all set!

REALLY CONFUSED? Don’t worry, I can do (some of) this for you. It took me a really long time to get all this working, and it takes me just a few minutes to import even a few years of entries. Send a zipped package of your XML files to lj2mt@amanita.net, and leave a comment here or e-mail me to let me know you’ve sent the file. I’ll send back a zipped package of “.mt” files for you to import.

CONVERSION WITH A CLICK? Yes, it’s true – I’m hoping to develop a web interface or small software program so you can convert your own files. Check in at the project’s homepage for more information.

DID THIS HELP YOU? If you followed these instructions and were able to successfully import your entries, please let me know! I’d love to hear I was able to help someone.

Consider signing up for the LJ2MT webring, too!

56 Responses to Importing LiveJournal Entries to Movable Type

  1. Reverend Jim

    This is a great tutorial. Thanks for sharing.

    There is actually an easier way (and much more automated). Since both LiveJournal and MovableType (if you turn it on) have XML-RPC interfaces, it is easy to move items from one place to the other. Maybe I’ll work out a little script to do the dirty work tonight. I’ll let you know if I do.

  2. Niherlas

    Again, very good tutorial. I managed to get the script up and running on my own machine (MacOS X) without much trouble, and got everything converted. One of the things I’m still doing, however, is hunting down lj user tags, but that’s not very hard. :)

  3. Matt

    Fantastic tutorial! I’m about to make the LJ/MT switch myself, so this was really helpful.

    I found an easy way to automate the whole process (with a little extra unix know-how). Drop all of those .xml files into a directory that will contain only themselves and the ‘lj2mt.pl’ script. At the command line do this:

    $> foreach i (*.xml)

    This will then start the foreach loop. At the ‘foreach?’ prompts type this:

    foreach? set a=`echo “$i”| sed -e ‘s/\(.*\).xml/\1.mt/’`
    foreach? ./lj2mt.pl $i your-blog-user-name > $a
    foreach? end

    This will cause each of the .xml files to be automatically migrated to the .mt files (presuming there are no errors. :)

    Oh, and for Cassie that posted earlier, try downloading Perl for Windows from ActiveState. You’ll still have to install the CPAN modules, as well as change the path to perl at the top of the ‘lj2mt.pl’ script, but it should still work.

  4. Matt

    I’m trying to run this with ActivePerl 5.6.1…which seems to have 2.7 of XML-Parser…which gives me this error:

    syntax error at line 1, column 0, byte 0 at C:/Perl/site/lib/XML/Parser.pm line 168

    I attempt to upgrade XML-Parser through PPM, which it won’t do, and if I update the modules, I get all sorts of other errors inside ActivePerl.

    Ideas?

    m.

  5. Carthik

    Thank you for this interesting article. I went one step further, and, after importing entries, went on to use another script which lets me post my latest MT entry in my Livejournal automatically.
    Please see My Article on LJ to MT migration for details.

    If you need help helping people create the .mt files, let me know, I use a linux laptop so I can do it on my system quite easily.

  6. Anonymous

    Great tutorial, but what am I doing wrong?

    The conversion seems to work flawlessly, but when I go to MT and try to import, it tells me:

    “Invalid date format ’09/03/2003′; must be ‘MM/DD/YYYY HH:MM:SS AM|PM’ (AM|PM is optional)”

    Any help? Thanks.

  7. Anonymous

    Hey, I ran into the invalid date format too.. just do an edit on the .mt file and replace all instances of /2003 with /2003 12:00:00 , all your imported entries will come in with a time of 12 noon, but since LJ isn’t exporting the times anyway it’s no big deal.

  8. Genevieve

    I’m new to this site, just browsing around

  9. jobby

    Got a fix for the date bug – if you replace

    #my $mtDate = strftime("%m/%d/%Y %r", localtime($time));

    with

    my $mtDate = strftime("%m/%d/%Y %H:%M:%S %p", localtime($time));

    , MT imports it with no problems. Great script, by the way.

  10. prettydaisies

    fabulous tutorial. i got through everything but the import without an issue. MT tells me that the data from my import file, which is all of 6 posts for one month, has imported OK, but when i look at my entries list, nothing’s there. i checked the archives directory, but there’s nothing there, either.

    ideas? thanx!

  11. Gloria

    Hey,
    This is a very nice turorial, especially for dorks like me!! I tried very hard to get it to work, but I just can’t install XML::node…can you please help me convert them? I just emailed you my XML files as a zip. Thank you so much!!! :)

  12. Cassie

    Hello,

    I’m currently trying to export LJ-entries and import them to my website. The problem is… erm. I don’t know how. I mean, I don’t think I have access to the shells on the server. How would I be able to gain this kind of access? Thanks!

    Cassie

  13. Zaldor

    Well, I gave it a shot – maybe because I was trying to run the perl script on my PC instead of the server? I emailed you my exports maybe you’ll have better luck – Thanks!

  14. Tushar

    Great tutorial! Worked flawlessly. I wrote a little perl around LJ2MT to write .mt files all at once. This is before I scrolled down a little further and saw the unix conmmand-line equivalent. Doh!

    Thanks a heap.

  15. Dan

    This is THE source for people who want to convert their Livejournal entries to MT. I wouldn’t suggest anything else (at least for now ;) ). Thanks for your help!

  16. Vix

    I been looking for a why to convert my LJ special posts to MT, Your a angel!

    However I’m so confused, I’ll send you a zip of 2002-04.zip in a email Could you please convert.

    Muchly appreciated. BTW I’m blogrolling you and making a Blog note of this.. Lets know when you get the software Created if ya do.. I’d LOVE to support ya!

  17. Vix

    I’m so lost.. Sending you a zip.

    muchly appreciated.

  18. greendaisy

    There is a better option available for those who use Windows and can’t be bothered with installing Perl,etc:

    http://www.thejackol.com/projects/ljbackuptk

  19. Dallas

    Hey, thanks for sharing this code. It worked like a charm for me, and now I just need to work on filtering through my entries before marking them to public.

    One comment is that you said to type “lj2mt.pl aug01.xml mt-name > aug01.mt” but I had to type “perl lj2mt.pl aug01.xml mt-name > aug01.mt” in order to get it to work. I’m not sure if this was just my problem, or a minor detail left out, but it might be useful to someone who is getting an error.

  20. cygnoir

    Oops. I forgot a month when I sent you the files a while back. I just sent it … sorry!

  21. Dallas movers

    Scriptygoddess has an artible about how to move all your Live Journal content to Movable Type

  22. Meredith

    Thanks so much, “Dallas movers” – but you are 6 years too late, and obviously miss the big box at the top where I already mentioned that. Good job.

  23. LosAngelesMovers.net

    Instead of movable type, try finding a licensed mover that knows how to type!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>