Twitter 1x1 tracking gif URLs

0README
I was looking at the traffic New Twitter was sending across, having
opened Firebug to see just how wide the content was (too wide for my
848px-wide phone at 920px). I kept seeing 1x1 transparent .gifs, which
all True Patriots have been at war with since the 90s, so I was curious
as to what they were doing in there. There was nothing interesting in
the headers (except the expected six or so different ways to instruct
all browsers everywhere to not cache the content), but the URLs are
huge.
As far as I can tell from the five or six URLs I looked at, it's just
analytics data. There seems to be no harm in doing `echo
255.255.255.255 scribe.twitter.com >> /etc/hosts`, so I did that on the
machine that runs dnsmasq for the home network.
decode.rb
#! /usr/bin/env ruby
# Reads Twitter tracking links from stdin, spits out some pretty-printed JSON.
# Much more readable. If you want to try it out, cloning the repo and doing
# "./decode.rb < example-links" will run it on the links that I had, or you
# could paste the scribe.twitter.com URLs you find.
require 'uri'
require 'cgi'
require 'json'
loop {
(print "link: "; $stdout.flush) if $stdout.tty?
link = gets.chomp rescue exit
next if link.empty?
# This is probably fragile, but works for me as of 2011/08/06:
begin
puts JSON.pretty_unparse(
JSON.parse(CGI.parse(URI.parse(link).query)['log[]'][0]))
rescue
$stderr.puts "Couldn't recognize #{link}."
end
}
example-links
first-link-decoded.json