lib/term_extraction/zemanta.rb in term_extraction-0.1.4 vs lib/term_extraction/zemanta.rb in term_extraction-0.1.5

- old
+ new

@@ -1,19 +1,16 @@ +require 'crack' require 'net/http' -require 'nokogiri' require 'addressable/uri' class TermExtraction class Zemanta < TermExtraction def terms - terms = [] - data = Nokogiri::XML.parse(remote_xml) - - data.search('//name').each do |n| - terms << n.text + begin + Crack::XML.parse(remote_xml)['rsp']['keywords']['keyword'].map { |h| h['name'] } + rescue + [] end - - terms end def uri Addressable::URI.parse(gateway) end