Created
January 4, 2019 01:05
-
-
Save ninoseki/5e689376f6f3dda260eaca9364a26b5f to your computer and use it in GitHub Desktop.
Download favicons from given domains
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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