Skip to content

Instantly share code, notes, and snippets.

@ninoseki
Created January 4, 2019 01:05
Show Gist options
  • Save ninoseki/5e689376f6f3dda260eaca9364a26b5f to your computer and use it in GitHub Desktop.
Save ninoseki/5e689376f6f3dda260eaca9364a26b5f to your computer and use it in GitHub Desktop.
Download favicons from given domains
# frozen_string_literal: true
require "down"
def domains
File.readlines("domains.txt").map(&:chomp).reject(&:empty?)
end
def download_favicon(domain, download_to)
url = "http://www.google.com/s2/favicons?domain=#{domain}"
Down.download(url, destination: "#{download_to}/#{domain}.png")
end
domains.each { |domain| download_favicon(domain, "/tmp/icons" ) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment