Raspagem da dados com Hpricot e Sinatra

1,402 views

Published on

Published in: Self Improvement
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,402
On SlideShare
0
From Embeds
0
Number of Embeds
28
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide






















  • Raspagem da dados com Hpricot e Sinatra

    1. 1. $ ruby app.rb Raspando dados com Sinatra e Hpricot
    2. 2. { name: 'Emerson Vinicius', github: 'emersonvinicius ' }
    3. 3. Sinatra
    4. 4. require 'rubygems' require 'sinatra' get '/hi' do "Hello World!" end
    5. 5. require 'rubygems' require 'sinatra' get '/hi' do "Hello World!" end
    6. 6. require 'rubygems' require 'sinatra' get '/hi' do "Hello World!" end
    7. 7. require 'rubygems' require 'sinatra' get '/hi' do "Hello World!" end
    8. 8. Hpricot
    9. 9. require 'rubygems' require 'open-uri' require 'hpricot' url = 'http://br.weather.yahoo.com/brazil/sao-paulo/sao- paulo-455827/' tempo = Hpricot(open(url).read) (tempo/"[@id='yw-temp']").inner_text // 27°
    10. 10. require 'rubygems' require 'open-uri' require 'hpricot' url = 'http://br.weather.yahoo.com/brazil/sao-paulo/sao- paulo-455827/' tempo = Hpricot(open(url).read) (tempo/"[@id='yw-temp']").inner_text // 27°
    11. 11. require 'rubygems' require 'open-uri' require 'hpricot' url = 'http://br.weather.yahoo.com/brazil/sao-paulo/sao- paulo-455827/' tempo = Hpricot(open(url).read) (tempo/"[@id='yw-temp']").inner_text // 27°
    12. 12. require 'rubygems' require 'open-uri' require 'hpricot' url = 'http://br.weather.yahoo.com/brazil/sao-paulo/sao- paulo-455827/' tempo = Hpricot(open(url).read) (tempo/"[@id='yw-temp']").inner_text // 27° #WIN
    13. 13. O que fazer com isso?
    14. 14. Obrigado! { name: 'Emerson Vinicius', twitter: '@emersonvinicius', gtalk: 'duke.m16', github: 'emersonvinicius ' }

    ×