#coding   #english   #OpenSource   #ruby

crontab'ed linden mania with hpricot

February 3, 2007

a kind of buzzwordy post title, i know, but hey, at least i kept the unavoidable second life out of it. For reasons far from being thrilling enough to tell here i pulled the latest hpricot release and made my server pull the latest stats from linden labs frontpage every 6 hours. I'm kind of sad I could not get it up before the (ridiculous)3293499 residents mark, but once SL will hit the billion, it will still look like a pioneer. So here is the beef: I made a cronjob screenscraping secondlife's stats from their frontpage. A nice graph from the data i will put up soon hopefuly. And stay tuned for the raw data feed if you like. Lets see, a week i guess, before it becomes a nice exponential curve.

1. get value elements from the stats div

v = Hpricot(open("http://www.secondlife.com")).search("#SL_stats strong")

2. make it digestible

v.map { |e| e.innerText.gsub(/[$,]/, "").to_i }

3. dump the stuff

# is left as an exercise to the reade

and mine you'll get right here.

share this: