Created
October 27, 2010 17:01
-
-
Save waynegraham/649456 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open3' | |
require 'open-uri' | |
require 'rubygems' | |
require 'nokogiri' | |
search = 'rocket science' | |
results = open "http://search.lib.virginia.edu/catalog?q=#{URI.escape(search)}&per_page=2" | |
Open3.popen3('say -v Vicki') do |stdin, stdout, stderr| | |
stdin << "Virgo results for #{search}..." | |
Nokogiri::XML(results).search('.document').each_with_index do |d,i| | |
stdin << "Item #{i+1}," | |
stdin << "Catalog key, #{d['id'].gsub(/^Doc/,'')}," | |
stdin << "Title, #{d.at('.titleField a').text}," | |
end | |
stdin.close | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment