lib/plagiarism/strategries/yahoo.rb in plagiarism2-0.0.5 vs lib/plagiarism/strategries/yahoo.rb in plagiarism2-0.0.6

- old
+ new

@@ -7,15 +7,15 @@ def fetch(content, params) Typhoeus.get(URL, params: params.merge(p: content)) end - def exists?(response) + def iterate(response) doc = Nokogiri::HTML response doc.css('.searchCenterMiddle li').all? do |row| - href = row.at_css('.compTitle div').content.strip rescue '' - uri = URI.parse URI::encode(href =~ /^http/ ? href : 'https://' + href) - uri.host =~ whitelists_regex + href = row.at_css('.compTitle a').attributes['href'].value rescue '' + uri = URI.parse URI::encode(href) + yield uri end end end