Created
September 12, 2009 18:39
-
-
Save heycarsten/185932 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Now all I have to do is make it work :-/ | |
scraper do |doc| | |
doc.css('.user-details', :on_missing => :halt) do |n| | |
n.css('.name') do |nn| | |
nn.emit do |content| | |
first, last = *content.split | |
{ :first_name => first, :last_name => last } | |
end | |
end | |
n.css('.age').emit(:age, :format => [/[0-9]+/, :to_i]) | |
n.css('.address').emit(:address, :format => [:strip]) | |
n.css('.country-code').emit(:country, :format => [:country_code_to_name]) | |
end | |
doc.css('.user-job-history ul li').all(:job_histories) do |li| | |
li.css('.company-name').emit(:company, :format => [:titlecase]) | |
li.css('.job-title').emit(:title) | |
li.css('.job-timeframe').emit_using(:job_dates) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment