#!/usr/bin/ruby require 'net/http' class JyteEntry def initialize(vfor, vagainst, title) @vfor = vfor @vagainst = vagainst @title = title end def print printf "[\033[32m#@vfor\033[0m " printf "\033[31m#@vagainst\033[0m]\t" printf "#@title\n" end end response = Net::HTTP.get_response("jyte.com", "/claims") jytes = Array.new() titles = response.body.scan(%r{a class=\"claim_title\"\n\s*href=\"http:(.*?)\">\n\s*(.*?)\n\s*}m) votesfor = response.body.scan(%r{votes_left_text_\d*\" style=\"color:#fff;\">(.*?)}m) votesagainst = response.body.scan(%r{votes_right_text_\d*\" style=\"color:#fff;\">(.*?)}m) 0.upto(9) do |i| jytes.push(JyteEntry.new(votesfor[i][0],votesagainst[i][0],titles[i][1])) end jytes.each {|x| x.print}