typepad2blogger

Happy Mother's day, Cpu. Your gift this year is a python module typepad2blogger for importing your typepad entries into blogger.
Install via easy_install typepad2blogger or using distutils from the source distribution setup install.

There are two modules and the main entry script:
  • typepad2blogger.mt : deserialize a moveable type export/import text file into a list of records.
>>> from typepad2blogger import mt
>>> filename = r'src/typepad2blogger/test/data/api.example.data'
>>> blog = mt.blog(filename)
>>> len(blog)
2
>>> blog[0]
<typepad2blogger.mt.entry object at 0x00B763F0>
>>> blog[0].body
<typepad2blogger.mt.body object at 0x00B80490>
>>> unicode(blog[0].body)
u'This is the body.\n'
  • typepad2blogger.blogger : configure a blogger connection and post entries
from typepad2blogger import blogger
email='name@domain.ext'
password='sekret'
blogname='My Meaningful Life'
blog = blogger.blog(email,password,blogname)
blog.connect()
publishdate = "2008-05-16T21:50:00.001-07:00"
entry = blogger.entry("First Post!","w00t!","Yours Truly",publishdate)
blog.post(entry,draft=False)
  • scripts/mt2blogger.py : given your blogger login info, the name of the blog to post to, and a moveable type text file as exported by typepad, post everything as drafts.
    • --publish option will publish the entries instead, but haven't tested what happens if an entry already exists. This is unhandled. A new empty blog should work ok though.
    • For example, if your typepad blog is exported to mymeaningfullife.htm, to import everything as published entries,
c:\python25\scripts\mt2blogger.py --publish name@domain.ext sekret "My Meaningful Life" mymeaningfullife.htm

In general, mt.blog entries have properties that correspond to the blocks of data; mt.metadata, .body, .extendedbody, and so-on. If the data type is described as keyed, it was converted to a dict. If the datatype was a multi-line string, it was converted to a string-like object that can be str() and unicode(). If a data field was described as a list, it is presented as a list. KEYWORDS:, which is not described in the documentation at all, is presented as a multi-line string. There was no coherent definition of the keywords field, so this was the least of all evils.

typepad2blogger.mt objects are currently only created empty or using a text string. Newlines are converted to unix in mt.blog.read() and in each mt object.

Test data currently includes blog entries copyright (c) Carrie Kirby 2008.

Unfortunately, the time conversion forces everything to central time zone, USA (Chicago CST). That's alpha for you.

Recent Tweets