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 / twitter.rb
100644 22 lines (16 sloc) 0.517 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'rubygems'
require 'scrubyt'
 
# Simple exmaple for scraping basic
# information from a public Twitter
# account.
 
# Scrubyt.logger = Scrubyt::Logger.new
 
twitter_data = Scrubyt::Extractor.define do
  fetch 'http://www.twitter.com/scobleizer'
 
  profile_info '//ul[@class="about vcard entry-author"]' do
    full_name "//li//span[@class='fn']"
    location "//li//span[@class='adr']"
    website "//li//a[@class='url']/@href"
    bio "//li//span[@class='bio']"
  end
end
 
puts twitter_data.to_xml