Module: WhiteKnight

Defined in:
lib/white-knight.rb,
lib/white-knight/version.rb

Constant Summary collapse

VERSION =
'0.0.1'
@@agent =
Mechanize.new { |agent| agent.log = Logger.new STDERR }

Class Method Summary collapse

Class Method Details

.run(url) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/white-knight.rb', line 9

def run url
  puts "WhiteKnight v#{WhiteKnight::VERSION}"
  page = @@agent.get url
  page.images.each do |image|
    takedown image
    sleep 10
  end
end

.takedown(url) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/white-knight.rb', line 18

def takedown url
  puts "Submitting takedown request for #{url}"
  Mail.deliver do
    from    ENV['WK_FROM']
    to      '[email protected]'
    subject "Removal request for image #{url}"
    body    "The image hosted at #{url} is exploitative and was taken without permission. Please remove it."
  end
end