Fixing Xanga’s Broken RSS Feeds
I finally decided to break down and make use of RSS feeds through an RSS aggregator instead of just reading everything through my LiveJournal friends page. I picked NetNewsWire by Ranchero Software as my client of choice. Unfortunately, when I tried to add the feeds for some people I read on Xanga, nothing would show up. A little bit of googling led me to discover that the problem is due to the fact that Xanga’s feeds don’t validate as proper RSS feeds. They erroneously close the channel tag off after the closing link tag (which is near the beginning) instead of before the closing rss tag (which is at the very end). Rather then letting this problem prevent me from reading Xanga journals through NetNewsWire, I wrote a small Perl script to fix the problem.
To use the script, you’ll have to have access to a webserver that supports Perl. Simply download the script, upload it to a location on your server that will let it run as a CGI script, rename it from xanga.pls to xanga.pl (or xanga.cgi), set the permissions correctly, and then give it a try! If you don’t know how to install a Perl script and can’t figure it out with the above brief instructions, then you might try to google for help on installing Perl scripts (I just did a quick search and found tutorials at webreference.com and about.com).
The script itself requires no internal configuration to make it work (unless your server has Perl installed at a non-standard location). It does require two modules, CGI and WWW::Mechanize, both of which are probably already installed on your webserver. If they aren’t installed already, you’ll either have to ask your web host to install them or figure out how to install them yourself (check out CPAN for some info on that).
Using the script is simple. If you have it installed at http://example.com/cgi-bin/xanga.cgi, then to access the RSS feed for a friend with a Xanga user name of SamplePerson, you’d tell NetNewsWire (or whatever you’re using instead) to access http://example.com/cgi-bin/xanga.cgi?friend=SamplePerson to get their feed. If you’ve done everything correctly, the person’s entries should pop right on into your news aggregator! (Assuming the person you’re looking at has some entries in their Xanga journal, of course.)
Wondering how the script works? It’s quite simple, really. First it removes the bad </channel> tag. Then it replaces the </rss> tag with </channel></rss>. The nice thing is that this script should continue to work even if Xanga fixes their feeds. Of course, you’ll probably want to stop using it after that point, but it’s nice to know that you won’t have to figure that fact out by realizing that you’ve not been seeing any Xanga entries show up for a few weeks.
The script, of course, is provided as is, with no guarantee that it’s actually going to work. You use it as your own risk, yadda yadda yadda. You should know the drill by now if you’ve ever downloaded free software/scripts/etc. from the net before. :)
October 17th, 2004 at 3:12 pm
Try this:
Remove lines 13, 16, 17, and 26 from the original script.
Change the end of original line 20 from “?user=’.$form->{friend}” to “?user=$ARGV[0]”
Save as a local file with execute privileges (chmod 755 xangarss.pl)
Now, in NetNewsWire 2.0b, you can run this as a “script subscription”, with the Xanga ID of the blog in question as the argument. No Web server, Apache, or CGI stuff needed at all. Just be sure set the permissions to allow execution, and put the right user ID (the “XANGANAME” part) as the argument to the script.
You only need one copy of the script; just change the argument to subscribe to as many Xanga blogs as you want. Props to Nat for doing this at my request, but his answer is so simple that everyone should use it. :-)
(of course, it still requires the WWW::Mechanize module, but that’s not all that hard to install with CPAN)
October 17th, 2004 at 3:15 pm
Oops:
Change line 20 from:
$agent->get(’http://xanga.com/rss.aspx?user=’.$form->{friend});
to:
$agent->get(”http://xanga.com/rss.aspx?user=$ARGV[0]”);
(messed up the single quoting, sorry)