Sha256: e0f394d07d35570b4ddee031e904adfad094849929294ef6014721c1fb7c82fc

Contents?: true

Size: 610 Bytes

Versions: 3

Compression:

Stored size: 610 Bytes

Contents

module Plagiarism
  module Strategies
    class Yahoo < Engine
      URL = 'https://search.yahoo.com/search'

      class << self

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

        def exists?(response)
          doc = Nokogiri::HTML response
          doc.css('.searchCenterMiddle li').all? do |row|
            href = row.at_css('.compTitle div').content.strip rescue ''
            uri = URI.parse(href =~ /^http/ ? href : 'https://' + href)
            uri.host =~ whitelists_regex
          end
        end

      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plagiarism2-0.0.3 lib/plagiarism/strategries/yahoo.rb
plagiarism2-0.0.2 lib/plagiarism/strategries/yahoo.rb
plagiarism2-0.0.1 lib/plagiarism/strategries/yahoo.rb