Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Finds favicons and DESTROYS THEM (well, not really, but it will download and save them)

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
README.markdown

iconoclasm

Finds favorites icons for web pages on the world wide internets by checking the HTML head or the standard favicon location. Then, do with them what you will.

Called "iconoclasm" because there was already a gem on gemcutter called "iconoclast". Boo! Hiss!

Usage

To get the favicon for a page, do:

favicon = Iconoclasm.extract('www.website.com')

This will go and do a bunch of GETs (two or three, actually) on the url given. If you've already got the content and want to skip one of the GETs, you can pass the content in as the second argument.

content = get_some_content('www.website.com')
favicon = Iconoclasm.extract('www.website.com', content)

Iconoclasm.extract returns an Iconoclasm::Favicon instance, from which you can get the URL, content type, size, or access the binary image data. By calling valid?, you can check if the favicon is valid based on whatever my standards were when I wrote this (basically, whether or not it's actually an image).

You can save the image to a tempfile using favicon.save, or more usefully, to a file at favicon.save('path/to/file'). Fun times had by all.

Copyright

Copyright (c) 2009 Sander Hartlage. See LICENSE for details.

Something went wrong with that request. Please try again.