/ Published in: Ruby
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/env ruby require "rubygems" require "twitter" require "active_support" require "google_chart" twitter_user = "" twitter_pass = "" httpauth = Twitter::HTTPAuth.new(twitter_user, twitter_pass) client = Twitter::Base.new(httpauth) totals = {} client.friends_timeline(:count => 200).each do |t| user = t.user.screen_name if !totals.has_key? user totals[user] = 1 else totals[user] +=1 end end pc = GoogleChart::PieChart.new('500x200', "Total Proportion of Recent Tweets", false) totals.each do |key,val| pc.data key, val end puts pc.to_url