lib/term_extraction/yahoo.rb in term_extraction-0.1.4 vs lib/term_extraction/yahoo.rb in term_extraction-0.1.5
- old
+ new
@@ -1,21 +1,16 @@
-require 'nokogiri'
+require 'crack'
require 'addressable/uri'
require 'open-uri'
class TermExtraction
class Yahoo < TermExtraction
def terms
- terms = []
- data = Nokogiri::XML.parse(remote_xml)
-
- unless data.nil?
- data.search('//s:Result', ns).each do |n|
- terms << n.text
- end
+ begin
+ Crack::XML.parse(remote_xml)['ResultSet']['Result']
+ rescue
+ []
end
-
- terms
end
def uri
api_uri = Addressable::URI.parse(gateway)
api_uri.query_values = {
\ No newline at end of file