http://bit.ly/zZgUr のレスポンスヘッダ

Live HTTP headers のログ

http://bit.ly/zZgUr

GET /zZgUr HTTP/1.1
Host: bit.ly
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,ja;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://twitter.com/shachi/status/1943698266
Cookie: ...

HTTP/1.x 301 Moved Permanently
Server: nginx/0.7.42
Date: Thu, 28 May 2009 04:50:08 GMT
Content-Type: text/html;charset=utf-8
Connection: keep-alive
Content-Length: 153
Location: http://japanese.engadget.com/2009/05/27/nerf-and/
Allow: GET, HEAD, POST

新しくTwitterが採用した、URL短縮サービスbit.lyを展開してみよう。

APIを使うのはAPIキーが必要になったりして面倒だなー、と思いながらtinyurlの展開をしてるtig.rbのコードを読んでみた。そしたら、実に賢いことしてた。

実際にURLにアクセスして、Locationヘッダを見てる。すげーな、これ。これなら、大抵の短縮URLサービスが展開できるじゃないか。

http://d.hatena.ne.jp/mzp/20090508/bitly

GM_xmlhttpRequestして、responseDetails.responseHeadersのLocation:を切り取る方がわずかに早くて負荷が少ないかも。

http://otsune.nowa.jp/entry/978ce4d80e