特定のTweet引用時の正書法

英語論文で特定のツイート引用時の正書法について書かれているブログ記事を拝見しました。
英語論文におけるツイートの正しい引用のしかた[MLAスタイル]:エディテック:ITmedia オルタナティブ・ブログ

この正書法に則るために、なんどもコピペするのがめんどい人のためのrubyスクリプト(要nokogiri)

#!/usr/bin/ruby
# -*- coding: utf-8 -*-

require "open-uri"
require 'nokogiri'

if ARGV.length != 1 then
  puts "Error: No parameter."
  exit
end

my_uri = ARGV[0].dup #パラメータは.dupしないと変更できない。
if my_uri =~ %r{^https://twitter.com/.+/status/\d+$} then
  my_uri.sub!(%r{^https://twitter.com/#!/}, "https://twitter.com/")
else
  puts "Error: Is not Twitter-uri."
  exit
end


#XHTMLのパース
doc = Nokogiri::HTML(open(my_uri))

#XPathで各エレメントから文字列を取り出す
my_fullname = doc.search('div[@class="full-name"]').text.to_s#ユーザーフルネーム
my_id = doc.search('meta[@name="page-user-screen_name"]').attribute('content').to_s#ユーザーID
my_entry_content = doc.search('span[@class="entry-content"]').text.to_s#エントリー内容
my_time = doc.search('span[@class="published timestamp"]').attribute('data').to_s#エントリー時間
my_time.sub!(/^{time:'(.+)'\}/) {$1}


#書式にあわせてprint
print "#{my_fullname} (@#{my_id}). “#{my_entry_content}” #{my_time}. Tweet.\n#{my_uri}\n"

パーマリンクを指定して実行すると、こんな感じになります。
f:id:seuzo:20120310173443p:image
本当はTwitter APIでとってくればXMLでより正確にtextを取れるのかもしれないけど、とりあえずclass名とかで取れています。まあ、日付をパースしなおして日本時間にしてもいいかな。
もし万が一、ちゃんと使う人がいるようだったら -j オプションで日本語引用風にするとか考えます。
とりあえず。