Sha256: 499e90b7d519c2704cbabc009c2f26e4f22961c7f273458bf7ae43340924989f

Contents?: true

Size: 622 Bytes

Versions: 2

Compression:

Stored size: 622 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 URI::encode(href =~ /^http/ ? href : 'https://' + href)
            uri.host =~ whitelists_regex
          end
        end

      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plagiarism2-0.0.5 lib/plagiarism/strategries/yahoo.rb
plagiarism2-0.0.4 lib/plagiarism/strategries/yahoo.rb