Exporting a Vox Blog
Sunday project!
Export a Vox blog to MTIF (Movable Type Import Format), along with some CSS to style it.
Requires Python, httplib2, Feed Parser and Beautiful Soup.
- Edit Posted July 19, 2009 at 9:49 PM PST in Code, CSS, Hacks, Internet, Python, Vox
- Previous: Augmented Reality: NYC Subway
- Next: Big Words Indeed
- Leave a Comment
Comments
July 19
10:03 PM
Edit
Mark Simmons writes:
how did it go?
July 19
10:12 PM
Edit
ydnar writes:
Pretty sure I byrned a few folks’ TypePad feed. 550 posts imported successfully!
October 16
12:31 PM
Edit
Chris Devers writes:
I keep trying to run this, but am hitting a Python error. The script run ends as follows:
$ /sw/bin/python2.6 vox2mtif.py chrisdevers
Fetching post content (this could take a while)...
Fetching content for: Posterous
Traceback (most recent call last):
File "vox2mtif.py", line 208, in
sys.exit(main())
File "vox2mtif.py", line 200, in main
vp.fetch_entry_content(entry)
File "vox2mtif.py", line 132, in fetch_entry_content
entry['full_content'] = div.decodeContents()
TypeError: 'NoneType' object is not callable
Looking at the script, the method it refers to is:
def fetch_entry_content(self, entry):
print u'Fetching content for: %s' % entry.title
soup = BeautifulSoup(self.fetch(entry.link))
div = soup.find('div', {'class': 'asset-body'}) or soup.find('div', {'class': 'asset- body preview-links'})
entry['full_content'] = div.decodeContents()
I don't see this decodeContents() method defined anywhere in vox2mtif.py, nor do I see it in the files that comprise BeautifulSoup, nor for that matter can I find the string "decodeContents" in any file anywhere under my /sw/lib/python2.6 or /Library/Python folders:
# grep -rail decodeContents /sw/lib/python2.6 /Library/Python
#
Google isn't helping me either. Is this a bug in your script, or one of the referenced libraries, or somewhere else like the Vox feed itself?
(My Python is shaky...)
Thanks!
January 13
2:28 AM
Edit
Brad writes:
Hi! I have the same question as Mr. Devers. Everything works fine until the uncallable-'Nonetype' error.
Where have I gone wrong? Please advise, if it's not too much trouble. Thanks!
January 13
8:44 AM
Edit
ydnar writes:
I’ll take a look!