Live Space Mover

As Microsoft has announced Live Space to WordPress.com migration, the recommended way now is to use the official function. If you want to move Live Space to a self-hosted WordPress, create a blog on WordPress.com as a bridge (export from WordPress.com blog then import to your self-hosted WordPress).

Thank all guys who cared about this script ;)

A python script for importing blog entries from live space to WordPress.

With Google blog converter you may also be able to move from live space to blogger/TypePad/Moveable Type/Live Journal blog. (See note 2 if you want to use this script with Google blog converter).

Tested on Python 2.5/2.6 and Windows XP/Ubuntu Linux.

Based on the wonderful HTML parser library BeautifulSoup.

Hosted on Google Code, Source code svn is

svn checkout http://live-space-mover.googlecode.com/svn/trunk/ live-space-mover

If there are any problems when using this script, feel free to contact me. weiwei9 AT gmail dot com

User Guide

  1. Install Python runtime and Beautiful Soup. There are 2 combinations tested by me:
    1. Python Runtime 2.5.2 and Beautiful Soup 3.0.6
    2. Python Runtime 2.5.1 and Beautiful Soup 3.0.4 and a small fix in note 1

    Place the file BeautifulSoup.py in the same directory of live-space-mover.py, or install it into Python runtime by yourself

  2. Download the newest release zip from the hosted page, extract it. (Older versions may become unusable because of the HTML changes of Live Space).
  3. Change your live space settings
    1. Make sure it is open to anyone (not only to your contacts)
    2. Set time zone to the same with your wordpress blog
    3. Set date format to yyyy/mm/dd, or mm/dd/yyyy. This probably depends on the locale setting of your system or browser, the point is to make the “YEAR” appear in your date. If the program fails and complains about date parsing, try to use the option -t to specify date time format. For example, the time on my space is shown like “9:45 PM”, but if your time is shown like “9:45:15 PM”, you may want to use a command line like below

      python live-space-mover.py -s http://yourspaceid.spaces.live.com/ -t "%m/%d/%Y %I:%M:%S %p"

      An introduction for the time format parameters are available here.

    4. Set “Blog entry date display” to “Show the blog entry date in the header”
    5. From some users’ feedback, I noticed themes of live space differ slightly in structure, which may lead to failure of this program. So please change your live space theme to “Journey” (the same as my experiment space).
  4. Run the live-space-mover.py script. In Windows, open the command line (win+R, enter “cmd” and return), change to the directory (use “c:”/”d:” to change disk, use “cd” command to change directory, please google it for help if need) of live-space-mover.py, run command like this

    python live-space-mover.py -s http://yourspaceid.spaces.live.com/

    Replace the example parameter with your own. This will generate an XML file named “export_xxxxx.xml” in the same directory of this script, which is in WordPress export file format.
  5. Use the import function in WordPress to import the XML file generated in the last step, remember to choose “WordPress” type in the import page, rather than “LiveJournal” or something else.

Notes

  • A known limitation: can’t fetch comments after the first page!
  • If you met an “UnicodeDecodeError”, that’s probably because your live space contains Italian or other languages. There is a bug in Python 2.5, you need to fix it. Yes, fix Python library by your own hands :P
    If you installed Python to it’s default path on Windows, what you need to do is to change the file C:\Python25\Lib\sgmlib.py, in line 394
    if not 0 <= n <= 255:
    should be changed to
    if not 0 <= n <= 127:
    That’s all, I learned this from here
  • If you want to use Google blog converter with this script, the recommended way is to open a new blog on WordPress.com or any other wordpress powered BSP, import the XML generated by this script and export a new XML with the built-in exporting function of WordPress, then feed Google blog converter with this new XML, because I can’t make sure XML exported by this script will meet Google blog converter’s requirement. Another thing to remember is you should change timezone of every place to UTC, including live space, wordpress blog, and the machine used to run this script. Thank 1nm for sharing experiences about Google blog converter.
  • This mover heavily depends on some very weird and sucking patterns of HTML and JavaScript codes in live space. So it may become unusable at any time….in that case please inform me
  • As I studied, the metaWeblog API in WordPress seems not to support comments? WordPress supports other two kinds of XML-RPC interfaces, too, blogger and MovableType. The blogger API has been updated to GData, and the old API looks not supporting comments, too. The documentation of MovableType API is so complex….I can’t understand yet.So maybe it would be much easier to write a mover with PHP which can handle comments.
  • This script may generate log file and cache file in the working directory. If you met some errors, it would be very helpful to send the log file and error message to me. Thank you.
  • You can use command

    python live-space-mover.py -help

    to check other options of this script
  • Since version 1.0, the suggested usage method is to export an xml file then import it. The directly posting method with MetaWeblog interface has been deprecated but left in the release package for anybody’s needs.

Change Log

* Version 1.8
– CHG: Catch up with changes of live space

* Version 1.7.6
– CHG: Modify exported date format to be compatible with WordPress2Blogger converter.

* Version 1.7.5
– BUG: Handled the weird format of comment date box

* Version 1.7.4
– BUG: Fixed the comments order problem reported by Sun Yue

* Version 1.7.3
– BUG: Fixed the problem when comment author name contains emoticons

* Version 1.7.2
– BUG: Fixed the pubDate of post item for WP 2.7

* Version 1.7.1
– BUG: Fixed the comment author missing

* Version 1.7
– CHG: Catch up with changes of live space in Dec 2008

* Version 1.6
– CHG: Catch up with changes of Live Space
– BUG: Fix the bug “can’t scan domain name with hyphen when comments are more than 20”

* Version 1.5
– CHG: Catch up with changes of Live Space
– BUG: Escaped special chars for XML
– NEW: Improved error logging when parsing error

* Version 1.4
– BUG: Converted unicode numbers (in category name, entry title and comment author) to unicode string. The bug of duplicate categories in WP 2.3 was solved by this.

* Version 1.3
– NEW: Support category exporting by setting header field ‘User-Agent’ to Firefox

* Version 1.2
– Catch up with some changes of live space

* Version 1.1
– BUG: Error when title is empty
– NEW: Add cache and resume ability

* Version 1.0
– Use XML file and import function of WordPress, instead of MetaWeblog and post
– Change some fetching codes according to the code changes of live space
– Fixed a bug of extracting email address of comment author

* Version 0.93
– Add Donate Link

* Version 0.92
– Fix some bugs

* Version 0.9
– NEW: Support moving comments. Add file “my-wp-comments-post.php” for posting comments
– NEW: Add running modes, for only moving posts/comments, or both

* Version 0.2
– BUG: Error when reading live space in Italian or other languages. Actually it’s a bug of Python 2.5.
– BUG: Doesn’t jump out loop after moving the oldest entry.
– NEW: Support date format pattern specifying, added -t option
– NEW: Support starting from a specified entry, added -f option

* Version 0.1
– NEW: Starting, used to move my own live space

Thanks

Great Thanks for Michele Nasti and Oliver Diaz Herrera, they used this script, reported bugs to me and helped me to solve them. I’m not a patient guy and I don’t have many blogs to test this script too much. It’s them, the nice users, who made this script really usable.

It’s so wonderful to cooperate with guys all around the world ;-p

204 comments

  1. Thank you soooooooooo much!!!!
    I want also tell you that your tool works beautifully also on Mac (not surprisingly, since OSX has an UNIX shell). And I just moved all my posts in 5 minutes!

  2. 你好,试了一下午,我按照你说的设置全改了,还是提示这个错误,实在是不解。希望你能帮我看看,谢谢。
    LINE 475 : INFO No more entries in cache file for loading
    LINE 243 : INFO connectiong to source blog http://fangilf.spaces.live.com/
    LINE 245 : INFO connect successfully, look for 1st Permalink
    LINE 259 : INFO Found 1st Permalink http://fangilf.spaces.live.com/blog/cns
    !DC6A19AFA35954F3!396.entry
    LINE 80 : WARNING date:
    LINE 81 : WARNING None
    LINE 82 : WARNING Can’t find date
    LINE 573 : ERROR Unexpected error
    Traceback (most recent call last):
    File “live-space-mover.py”, line 571, in
    main()
    File “live-space-mover.py”, line 494, in main
    i=fetchEntry(permalink,datetimepattern,mode)
    File “live-space-mover.py”, line 83, in fetchEntry
    sys.exit(2)
    SystemExit: 2

  3. Hi!

    The live-space-mover-1.6 folder is on my desktop.

    I navigated in the command prompt to c:/documents and settings/someone/desktop>

    and entered the command line given

    python live-space-mover.py -s http://blogid.spaces.live .com/

    and it says: ‘python’ is not recognised as an internal or external command, operable program or bathc file.

    Please help. I REAALLYY wanna migrate out of live space!

    Thanks in advance!

  4. @Chris: Thanks for the info. Live Space Mover almost only takes the default template into account. If a guy can tweak his page, I believe he can tweak it back :)

  5. I’m here to report a little bug. Because my live space has a banner, i puted my space title to the bottom of my index page, but then live space mover can’t catch my title. Therefore created a error. I simply put my title on top of the index page and then Live space mover work fined, thak you 衛偉!

  6. 很謝謝你的程式,但我在執行時遇到一點小問題如下:

    LINE 540 : ERROR Unexpected error
    Traceback (most recent call last):
    File “live-space-mover.py”, line 538, in
    main()
    File “live-space-mover.py”, line 461, in main
    i=fetchEntry(permalink,datetimepattern,mode)
    File “live-space-mover.py”, line 136, in fetchEntry
    comment[’email’]=mailAndName[‘href’][len(‘mailto:’):]
    File “C:\Documents and Settings\Miao\My Documents\MSN2WP\BeautifulSoup.py”, li
    ne 430, in __getitem__
    return self._getAttrMap()[key]
    KeyError: ‘href’
    Traceback (most recent call last):
    File “live-space-mover.py”, line 538, in
    main()
    File “live-space-mover.py”, line 461, in main
    i=fetchEntry(permalink,datetimepattern,mode)
    File “live-space-mover.py”, line 136, in fetchEntry
    comment[’email’]=mailAndName[‘href’][len(‘mailto:’):]
    File “C:\MSN2WP\BeautifulSoup.py”, line 430, in __getitem__
    return self._getAttrMap()[key]
    KeyError: ‘href’

    麻煩你了!!

  7. Mmmmmm…. It’s working like a charm…. Geez… I have a lot of blogs…

    Awesome! Thanks so much!

  8. Beautiful Soup has upgraded to 3.0.7a, and I’m having no luck running this thing. I don’t know if that’s my problem, but does someone have a version 3.0.6 I could use to try again?

    My error:

    C:\Python25>python live-space-mover.py -s http://byusaranicole.spaces.live.com/
    LINE 472 : INFO No more entries in cache file for loading
    LINE 240 : INFO connectiong to source blog http://byusaranicole.spaces.live
    .com/
    LINE 242 : INFO connect successfully, look for 1st Permalink
    LINE 256 : INFO Found 1st Permalink http://byusaranicole.spaces.live.com/bl
    og/cns!331D0D425D1D16D5!1749.entry
    LINE 570 : ERROR Unexpected error
    Traceback (most recent call last):
    File “live-space-mover.py”, line 568, in
    main()
    File “live-space-mover.py”, line 491, in main
    i=fetchEntry(permalink,datetimepattern,mode)
    File “live-space-mover.py”, line 98, in fetchEntry
    i[‘content’]=u”.join(map(CData,temp.contents))
    File “C:\Python25\BeautifulSoup.py”, line 410, in __new__
    return unicode.__new__(cls, value, DEFAULT_OUTPUT_ENCODING)
    TypeError: coercing to Unicode: need string or buffer, instance found
    Traceback (most recent call last):
    File “live-space-mover.py”, line 568, in
    main()
    File “live-space-mover.py”, line 491, in main
    i=fetchEntry(permalink,datetimepattern,mode)
    File “live-space-mover.py”, line 98, in fetchEntry
    i[‘content’]=u”.join(map(CData,temp.contents))
    File “C:\Python25\BeautifulSoup.py”, line 410, in __new__
    return unicode.__new__(cls, value, DEFAULT_OUTPUT_ENCODING)
    TypeError: coercing to Unicode: need string or buffer, instance found

  9. Is this going to work on a Windows Vista machine? Just curious before I try… my husband would kill me if I screwed up his brand new laptop… ;)

  10. oh hey.
    after tinkering with it a bit more this morning i realized i used the wrong versions haha.

    fixed it up, ran it and everything worked out just fine! big thanks broom9!

  11. Hey i believe im doing something very simple, wrong. I try entering the command but it didnt work. so i tried the help command but it didnt seem to work either.

    Any help would be much appreciated!

    C:\Documents and Settings\Compaq_Owner>cd desktop\msn mover

    C:\Documents and Settings\Compaq_Owner\Desktop\msn mover>python live-space-mover.py -help

    Traceback (most recent call last):
    File “live-space-mover.py”, line 21, in ?
    from BeautifulSoup import BeautifulSoup,Tag,CData
    File “BeautifulSoup.py”, line 1414, in ?
    class BeautifulSoup(BeautifulStoneSoup):
    File “BeautifulSoup.py”, line 1472, in BeautifulSoup
    PRESERVE_WHITESPACE_TAGS = set([‘pre’, ‘textarea’])
    NameError: name ‘set’ is not defined

  12. Pingback: 双叶@Donews
  13. To maomy: Thanks. I have been thinking about this for a long time, hehe. I’ll do it, as long as I’ve enough free time :)
    To yang: Thanks, too. I’m glad this script can work for THU guys, lol

  14. Thank you so much for your wonderful program. I’m a graduate from Tsinghua’s English major, and I’m CS illiterate…But based on so many people’s elaboration on your program, I have just used it to export stuff from my space. It is sooooo convenient and nice!

    Thanks!

  15. 九号楼的兄弟好,感谢你的程序…最近几个朋友都在找msn搬家的方法,搜到你这里。有没有可能发布一个不需安装python的简便些的程序啊?这个世界的技术盲还是很多的……

  16. Hi! What about this error, any clues?

    LINE 1091 : ERROR Unexpected error
    Traceback (most recent call last):
    File “live-space-mover.py”, line 568, in
    main()
    File “live-space-mover.py”, line 481, in main
    permalink = find1stPermalink(srcURL)
    File “live-space-mover.py”, line 243, in find1stPermalink
    soup = BeautifulSoup(page)
    File “/home/xxx/converter/BeautifulSoup.py”, line 1282, in __init__
    BeautifulStoneSoup.__init__(self, *args, **kwargs)
    File “/home/xxx/converter/BeautifulSoup.py”, line 946, in __init__
    self._feed()
    File “/home/xxx/converter/BeautifulSoup.py”, line 971, in _feed
    SGMLParser.feed(self, markup)
    File “/usr/lib/python2.5/sgmllib.py”, line 99, in feed
    self.goahead(0)
    File “/usr/lib/python2.5/sgmllib.py”, line 133, in goahead
    k = self.parse_starttag(i)
    File “/usr/lib/python2.5/sgmllib.py”, line 285, in parse_starttag
    self._convert_ref, attrvalue)
    File “/usr/lib/python2.5/sgmllib.py”, line 297, in _convert_ref
    return self.convert_charref(match.group(2)) or \
    TypeError: ‘NoneType’ object is not callable
    Traceback (most recent call last):
    File “live-space-mover.py”, line 568, in
    main()
    File “live-space-mover.py”, line 481, in main
    permalink = find1stPermalink(srcURL)
    File “live-space-mover.py”, line 243, in find1stPermalink
    soup = BeautifulSoup(page)
    File “/home/xxx/converter/BeautifulSoup.py”, line 1282, in __init__
    BeautifulStoneSoup.__init__(self, *args, **kwargs)
    File “/home/xxx/converter/BeautifulSoup.py”, line 946, in __init__
    self._feed()
    File “/home/xxx/converter/BeautifulSoup.py”, line 971, in _feed
    SGMLParser.feed(self, markup)
    File “/usr/lib/python2.5/sgmllib.py”, line 99, in feed
    self.goahead(0)
    File “/usr/lib/python2.5/sgmllib.py”, line 133, in goahead
    k = self.parse_starttag(i)
    File “/usr/lib/python2.5/sgmllib.py”, line 285, in parse_starttag
    self._convert_ref, attrvalue)
    File “/usr/lib/python2.5/sgmllib.py”, line 297, in _convert_ref
    return self.convert_charref(match.group(2)) or \
    TypeError: ‘NoneType’ object is not callable

  17. 感谢感谢感谢~
    虽然我不是搬到wordpress而是搬到私人空间。。。但是这个xml输出的功能实在太赞了~!!
    再次感谢!!!!!!=D

  18. You saved me! ; ) It’s been long time since I thought I should “abandon” Live Spaces, but it would have been really hurting to lose all my past entries… then I found your blog and you Live Space Mover, thanks, you’re great! : ) Even though I’m not very good (to be honest I’m not good at all!!) at using “command lines” and other stuff like that, I finally got to my brand new blog!
    Thank you very much!

Leave a Reply to Gemma Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.