kwc.org Photos Spare Cycles MythBusters

xanga2mt

Like the title of this entry implies, this Python script will scrape an entire Xanga feed and convert it into MovableType's input format. The intended audience for this script is people who are on Xanga, but either have or are in the process of moving over to MovableType.

I don't actually fall into the intended audience of this script, which makes it strange that I would write it, but I do have good motivations:

1) I needed to learn Python for work
2) I needed to learn regular expressions for work
3) I am going to reused this code to add in some new features to the feed aggregator so that it can display comments
4) MovableType is my uber tool, and everyone should be free to use it without cell phone number portability issues :)

I've only tested this on two Xanga accounts. If you have a really weird Xanga modifications, then this will most likely break. Version 0.1 contains one or two bugs, so the program will report ~2 errors when it's done. If there's interest, I'll put out a version 0.2 that fixes these bugs, plus any others that people find.

BTW - while I was injured I also taught myself a bit of Perl over the break, and then decided that learning Python and Perl at the same time was a really, really, bad idea.

So, without further adieu:
xanga2mt release 0.3

Update: upgraded to version 0.2, which fixes bugs with comment scraping

Update: upgraded to version 0.3, which contains a small fix to make the script compatible with more sites

TrackBack

Listed below are links to weblogs that reference xanga2mt:

» tripod2mt from kwc blog
Following quickly on the heels of xanga2mt, I know bring you tripod2mt. As you might be able to guess, it will convert the contents of a tripod journal into Movable Type's import format. It's not quite as good as xanga2mt;... [Read More]

Comments (15)

alejandra:

Im a friend of a friend! i dont have python either =(

Hi Kenneth,

I've just tried to use xanga2mt.py to convert my Xanga site to a Movable Type import file -- but it's returning the following:

opening xanga url http://www.xanga.com/home.aspx?user=davka
ERROR: could not find entries (1)
ERROR: could not find entries (2)
SCRAPE FAILED!

Xanga2MT Statistics:

0 entries
2 errors

Any chance you could try running it from your end? I'm sure I'm a friend of a friend of a friend of a friend...

Cheers,

Brad.

kwc:

Brad,

Thanks for giving the tool a try. I'll try and debug this tomorrow.

- Ken

kwc:

Brad,

I believe I've fixed the problem. The fixed script found 198 entries on your site. Let me know if this is correct. If you still have trouble running from you end, I can post the result for you.

Good luck converting to Movable Type,
Ken

Ken,

Brilliant, I was able to run version 0.3 no problems -- thanks so much for responding, that would have taken me hours to do by hand, obviously. One discrepency though -- when I ran it, it only turned up 191 entries (not the 198 you said it detected when run on your end). If you kept the file you retrieved, could you send it on?

Plenty of good karma accruing your way.

Brad.

jenni:

I just stumbled upon your weblog. Does this new tool also enable moving Xanga entries to Typepad?

kwc:

Yes, it should allow you to move xanga to typepad.

jenni:

thanks... but I have no idea what Python is or what to do with it. (Should I?)

kwc:

Jenni,

Give me the name of your Xanga account and I will do the conversion for you.

pavle:

Hey man,

I've been searching all over the internet to find a way to convert my xanga page into movable type... so far xanga2mt seems like the only way to do it. I tried DL'ing python and running it but I honestly have no idea how to. would you mind running it over on your end? usr = singidunum381

thanks,

pavle

kwc:

Pavle, if you can wait several days I'll run it for you. I'm currently out of the country on vacation.

Casey:

Hey boss. Also tried to download python and run for my std xanga site. This was the output and I did not see anything as far as a .txt file. I'm not the greatest on computers. Any chance I'm a friend of a friend...usr=compleatang.

Thanks.
C

>>> ================================ RESTART ================================
>>>
Usage:
xanga2mt [xangausername]


Traceback (most recent call last):
File "C:\Python24\xanga2mt.py", line 474, in -toplevel-
sys.exit()
SystemExit
>>>

Casey:

Hey boss. Also tried to download python and run for my std xanga site. This was the output and I did not see anything as far as a .txt file. I'm not the greatest on computers. Any chance I'm a friend of a friend...usr=compleatang.

Thanks.
C

>>> ================================ RESTART ================================
>>>
Usage:
xanga2mt [xangausername]


Traceback (most recent call last):
File "C:\Python24\xanga2mt.py", line 474, in -toplevel-
sys.exit()
SystemExit
>>>

Allen:

Hi, Is there was any way to get this program to copy protected posts from xanga as well

Hello

I want to move form xanga to movabletype with all the old posts.

I search in the internet and found that you have written a script, xanga2mt. Which can help me to complete the task. However I know nothing about python, I tried to install python and run the script. A black window appear and then disappear immediately. No xxx.txt is formed.

Could you teach me how to use the xanga2mt or help me to get the achieves?

My xanga id is : lammh

Thanks a lot,
Freddy

Post a comment


tags.

related entries.

what is this?

This page contains a single entry from kwc blog posted on February 2, 2004 11:15 PM.

The previous post was Trying to come up with a good domain name.

The next post is Your own federal budget, 2005.

Current entries can be found on the main page.