F
Feng Tien
I'm trying to grab the "cache date" off of the google search.
using Mechanize (and built in hpricot)
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)
cache_date = agent.click search_results.links.text('Cached')
date = cache_date.search('table table > td').inner_html
How do i grab the date like on this page:
http://209.85.173.104/search?q=cach...s=org.mozilla:en-US:official&client=firefox-a
the part that's right after "as retrieved on" (the date)
Is there a built in hpricot method that can search by rexep?
or will I have to use something like gsub?
using Mechanize (and built in hpricot)
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)
cache_date = agent.click search_results.links.text('Cached')
date = cache_date.search('table table > td').inner_html
How do i grab the date like on this page:
http://209.85.173.104/search?q=cach...s=org.mozilla:en-US:official&client=firefox-a
the part that's right after "as retrieved on" (the date)
Is there a built in hpricot method that can search by rexep?
or will I have to use something like gsub?