Now the we have MyWeb 2.0 (which by the way, is quite cool. I could imagine doing tons of things with it.), it’s time for an update to the Ruby interface to YWS—yahoo-ruby 0.2.
Do cool stuff:
require 'yahoo-ruby.rb'
obj = RelatedTags.new('yahoo-ruby', 'ruby', '', '', '', 1)
obj.parse_results.each { |ele|
ele.each { |k,v|
print "#{k} => #{v}\n" if v!=nil
}
}
# Output
Tag => rails
Frequency => 23
Date => 1120011775
The code’s been lying around for some time (observe the date—June 29), but I didn’t release it assuming there’d be an official release or something. Oh well.
I think I’m gonna make major changes to the code. It works well, mind you. However, I’m not satisfied with the design. Ideally I’d like to simply parse the XSD, and spit out a hash. That’d mean each time a new API comes out, I just have to add another schema location to the existing bunch. And I’m not terribly sure I can do that with REXML. Maybe I’m wrong, though, because, honestly, I haven’s dug into it very deep. Oh yeah, I’m gonna move the project to RubyForge.