Blogging Roller

Dave Johnson on open web technologies, social software and software development


The big day!

Wedding day best wishes to <a href= "http://diveintomark.org/archives/2003/05/17/the_big_day.html">Mark and Dora.

Tags: General

Technoratj

Well, this was inevitable. (Background: Technorati API released.)

Remember that whole not-taking-on-new-projects thing? Well, somebody else said that, not me. Which, honestly, is obvious to those who read that other RTP blogger.

Open source, Apache-licensed. Share and enjoy.

;-)

After looking at Mark Pilgrim's PyTechnorati and seeing how little Python code is needed to wrap the Technorati API (one file with 171 lines, not including the header comments), I developed a case of language envy. I decided to see what I could do with Java, JDOM, XPath, and a couple of inner classes. Technorati.java is the result (get the project here: technoratj.zip). My wrapper is about the same size as PyTechnorati, but it does not handle HTTP proxies as Mark's does (is there a FancyURLOpener for Java?). Seeing PyTechnorati also inspired me to revisit Jython. Here is how you'd use technoratj from Jython:

Jython 2.1 on java1.4.1_01 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> from org.roller.technorati import Technorati
>>> technorati = Technorati("YOUR_KEY")
>>> cosmos = technorati.getLinkCosmos("http://rollerweblogger.org/page/roller")
>>> cosmos.weblog.name
'Blogging Roller'
>>> cosmos.weblog.rssurl
'http://www.rollerweblogger.org/rss/roller'
>>> cosmos.weblog.inboundblogs
33
>>> cosmos.weblog.inboundlinks
44
>>> for blog in cosmos.weblogs:
...     print blog.name
...
BlogAtom
Erik's Weblog
Feelings and Thoughts
Quidnunc
Hacking Log 3.0: America's Blog
...

Note: I had to provide an EntityResolver and my own copy of the technorati.dtd because Technorati results sometimes contain mdash entities and mdash is not in Dave Sifry's DTD. The Technorati API can return malformed XML (I've seen ampersands in name and excerpt elements) and this is a problem for my wrapper. Is the Python MiniDOM more lenient about these issues?

Tags: Java

Main | Next day (May 18, 2003) »