Dave Johnson on open web technologies, social software and software development
« Babeldoc. | Main | The big day! »
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?
Dave Johnson in Java
06:20AM May 17, 2003
Comments [3]
Tags:
Java
« Babeldoc. | Main | The big day! »
This is just one entry in the weblog Blogging Roller. You may want to visit the main page of the weblog
Below are the most recent entries in the category Java, some may be related to this entry.
Posted by Jason on May 17, 2003 at 04:24 PM EDT #
Posted by Sam Ruby on May 17, 2003 at 07:07 PM EDT #
Posted by Peter on November 11, 2003 at 04:39 AM EST #