サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
デスク環境を整える
mechanize.rubyforge.org
Getting Started With Mechanize This guide is meant to get you started using Mechanize. By the end of this guide, you should be able to fetch pages, click links, fill out and submit forms, scrape data, and many other hopefully useful things. This guide really just scratches the surface of what is available, but should be enough information to get you really going! Let’s Fetch a Page! First thing is
Mechanize mechanize.rubyforge.org github.com/tenderlove/mechanize DESCRIPTION The Mechanize library is used for automating interaction with websites. Mechanize automatically stores and sends cookies, follows redirects, and can follow links and submit forms. Form fields can be populated and submitted. Mechanize also keeps track of the sites that you have visited as a history. Dependencies ruby 1.8.
The Mechanize library is used for automating interactions with a website. It can follow links and submit forms. Form fields can be populated and submitted. A history of URLs is maintained and can be queried. Example require 'mechanize' require 'logger' agent = Mechanize.new agent.log = Logger.new "mech.log" agent.user_agent_alias = 'Mac Safari' page = agent.get "http://www.google.com/" search_form
Mechanize examples Note: Several examples show methods chained to the end of do/end blocks. Do…end is the same as curly braces ({…}). For example, do … end.submit is the same as { … }.submit. Google require 'rubygems' require 'mechanize' a = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' } a.get('http://google.com/') do |page| search_result = page.form_with(:name => 'f') do |search|
http://mechanize.rubyforge.org/ http://github.com/tenderlove/mechanize/tree/master DESCRIPTION The Mechanize library is used for automating interaction with websites. Mechanize automatically stores and sends cookies, follows redirects, can follow links, and submit forms. Form fields can be populated and submitted. Mechanize also keeps track of the sites that you have visited as a history. Dependen
WWW::Mechanize examples Google require 'rubygems' require 'mechanize' agent = WWW::Mechanize.new agent.user_agent_alias = 'Mac Safari' page = agent.get("http://www.google.com/") search_form = page.forms.with.name("f").first search_form.q = "Hello" search_results = agent.submit(search_form) puts search_results.body Rubyforge require 'mechanize' agent = WWW::Mechanize.new page = agent.get('http://ru
このページを最初にブックマークしてみませんか?
『http://mechanize.rubyforge.org/』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く