Sha256: a952705ce34c83baf1e2b831bc37941367b822632c2460bc0a97fa33e4ecdc8e
Contents?: true
Size: 607 Bytes
Versions: 2
Compression:
Stored size: 607 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:not(.result--no-result)').all? do |row| href = row.at_css('.result__a').attributes['href'].value rescue '' uri = URI.parse URI::encode(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/duck.rb |
plagiarism2-0.0.4 | lib/plagiarism/strategries/duck.rb |