Class: Plagiarism::Strategies::Duck
- Defined in:
- lib/plagiarism/strategries/duck.rb
Constant Summary collapse
- URL =
'https://duckduckgo.com/html'
Constants inherited from Engine
Instance Attribute Summary
Attributes inherited from Engine
Class Method Summary collapse
Methods inherited from Engine
exists?, #initialize, #match, #retrieve_link, #unique?, valid_segments, whitelists_regex
Constructor Details
This class inherits a constructor from Plagiarism::Strategies::Engine
Class Method Details
.fetch(content, params) ⇒ Object
8 9 10 |
# File 'lib/plagiarism/strategries/duck.rb', line 8 def fetch(content, params) Typhoeus.get(URL, params: params.merge(q: content)) end |
.iterate(response, action = :all?) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/plagiarism/strategries/duck.rb', line 12 def iterate(response, action = :all?) doc = Nokogiri::HTML response doc.css('.results_links_deep:not(.result--no-result) .result__a').send(action) do |row| href = row.attributes['href'].value rescue '' uri = URI.parse URI::encode(href) yield uri end end |