public
Description: A handful (but hopefully growing amount) of scRUBYt! examples
Homepage: http://scrubyt.org
Clone URL: git://github.com/scrubber/scrubyt_examples.git
scrubyt_examples / favicon.rb
100644 18 lines (13 sloc) 0.469 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'rubygems'
require 'scrubyt'
 
# Simple exmaple for scraping the variety of favicon URLs from a particular site
# Scrubyt.logger = Scrubyt::Logger.new
 
favicon_url = Scrubyt::Extractor.define do
  fetch 'http://www.tumblr.com/'
 
  favicon '//head' do
    favicon_url "//link[@rel='shortcut icon']/@href"
    icon_url "//link[@rel='icon']/@href"
    apple_iphone_icon "//link[@rel='apple-touch-icon]/@href"
  end
end
 
puts favicon_url.to_xml