I am building a crawler, I know how to use ruby mechanize to read a page from the net using this code:
require 'mechanize'
agent = Mechanize.new
agent.get "http://google.com"
But can I use Mechanize to read an HTML file from the file system? How?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
IMHO it doesn’t make sense trying to use mechanize for such a situation. Maybe you would like to parse HTML. Then try nokogiri (mechanize uses it for parsing too)
e.g. use
instead of