#!/usr/bin/env ruby require 'rubygems' require 'mechanize' HELP_STRING =< elements tab.search("tr").each do |tr| what = tr.search("td[@class='label']") views = tr.search("td[@class='views']") whats = what.inner_text.strip() if not whats.empty? views = views.inner_text.strip() printf("%s -- %5s\n", whats.center(45), views) end end end end end # grab the div with the general (weblog level) statistics data gbdiv = doc.search("//div[@id='generalblog']") # find the

element with the number of views today vtoday = gbdiv.search("p").find { |p| p.inner_text.index('Views today') } if vtoday printf("\n%s\n\n", "=> #{vtoday.inner_text.strip} <=".center(45)) else puts "\n\n!! No weblog statistics data found." puts " Did you enter a wrong user name and/or password?" end