It's Mechanize for it. Ruby as a Finder.

3,413 views
3,326 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,413
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
12
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • It's Mechanize for it. Ruby as a Finder.

    1. 1. Mechanize Ruby
    2. 2. @Sixeight
    3. 3. Ruby
    4. 4. Machanize Google
    5. 5. photo by km6xo Mechanize automating interaction with websites.
    6. 6. WWW::Mechanize
    7. 7. WWW::Mechanize •Ruby
    8. 8. WWW::Mechanize •Ruby •Web
    9. 9. WWW::Mechanize •Ruby •Web •Cookies
    10. 10. WWW::Mechanize •Ruby •Web •Cookies •
    11. 11. WWW::Mechanize •Ruby •Web •Cookies • • Ruby
    12. 12. sudo gem install mechanize
    13. 13. agent = WWW::Mechanize.new
    14. 14. agent = WWW::Mechanize.new
    15. 15. agent = WWW::Mechanize.new
    16. 16. agent.get ‘http://google.com’
    17. 17. REST { GET, POST, PUT, DELETE } agent.get ‘http://google.com’
    18. 18. REST { GET, POST, PUT, DELETE } agent.get ‘http://google.com’
    19. 19. REST { GET, POST, PUT, DELETE } agent.get ‘http://google.com’
    20. 20. REST { GET, POST, PUT, DELETE } agent.get ‘http://google.com’
    21. 21. agent.page
    22. 22. #<WWW::Mechanize::Page {url #<URI::HTTP:0x101f39ab0 URL:http://www.goo {meta} {title "Google"} {iframes} {frames} {links #<WWW::Mechanize::Page::Link "347224273345203217" "http://images.google.co.jp/imghp?hl=ja&tab=wi"> #<WWW::Mechanize::Page::Link "345213225347224273" "http://video.google.co.jp/?hl=ja&tab=wv"> #<WWW::Mechanize::Page::Link "345234260345233263" "http://maps.google.co.jp/maps?hl=ja&tab=wl"> agent.page #<WWW::Mechanize::Page::Link "34320321334320324534320327434320 "http://news.google.co.jp/nwshp?hl=ja&tab=wn"> #<WWW::Mechanize::Page::Link "346233270347261215" "http://books.google.co.jp/bkshp?hl=ja&tab=wp"> #<WWW::Mechanize::Page::Link "Gmail" "http://mail.google.com/mail/?hl=ja&tab=wm"> #<WWW::Mechanize::Page::Link "343201235343201256344273226 30227 "http://www.google.co.jp/intl/ja/options/"> #<WWW::Mechanize::Page::Link "iGoogle" "/url?sa=p&pref=ig&pval=3&q=http://www.google.c %3Diglk&usg=AFQjCNEmQuNg1ivauCid9lXp5yYSx6 #<WWW::Mechanize::Page::Link "34624423434726424235025025534525
    23. 23. Google
    24. 24. require 'rubygems' require 'mechanize' agent = WWW::Mechanize.new agent.get 'http://google.com' agent.page.form_with(:name => 'f') do |f| f.field_with(:name => 'q').value = 'Ruby' f.click_button end puts agent.page.search('//h3').map(&:content)
    25. 25. agent.page.form_with(:name => 'f') do |f| f.field_with(:name => 'q').value = 'Ruby' f.click_button end
    26. 26. • Ruby • Ruby Programming Language • Ruby - Wikipedia • Ruby - Ruby • Ruby - • Ruby Wiki - Ruby Wiki • RDE(Ruby Development Environment) - Ruby • Ruby Annotation • Ruby 63 − IT • Ruby ITpro • Ruby
    27. 27. Ruby

    ×