Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
scrape total lives saved count from martin-baker web.
# coding: utf-8
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'date'
html = Nokogiri::HTML(open(''))
uls = html.xpath('//*[@id="totalLivesSaved"]')
count = 0
uls[0].xpath('li').each do |li|
numstr = li["class"].gsub(/number-/,'')
count = count * 10 + numstr.to_i
date ="%Y/%m/%d")
puts "#{date}\t#{count}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.