Sha256: e52b000af5a7add3e242c5f49b955f8f9921f026a96c471c6b05fa19098da7f4

Contents?: true

Size: 570 Bytes

Versions: 1

Compression:

Stored size: 570 Bytes

Contents

module Plagiarism
  module Strategies
    class Duck < Engine
      URL = 'https://duckduckgo.com/html'

      class << self

        def fetch(content, params)
          Typhoeus.get(URL, params: params.merge(q: content))
        end

        def exists?(response)
          doc = Nokogiri::HTML response
          doc.css('.results_links_deep').all? do |row|
            href = row.at_css('.result__a').attributes['href'].value rescue ''
            uri = URI.parse href
            uri.host =~ whitelists_regex
          end
        end

      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
plagiarism2-0.0.1 lib/plagiarism/strategries/duck.rb