Sha256: 2b1ec03cd8e8a315bd036de99fe85c99a48f2032df7adc36370f83da810fc500
Contents?: true
Size: 829 Bytes
Versions: 105
Compression:
Stored size: 829 Bytes
Contents
require 'rubygems' require 'hpricot' require 'open-uri' require 'cgi' $KCODE="u" def parse(html) results = [] (Hpricot(html)/"//table//tr").each do |tr| tds = (tr/:td/:span) if tds && tds.size > 0 results << tds.map {|td| CGI.unescapeHTML(td.inner_html)} end end results end table = [] %w(basic extention).each do |x| uri = "http://www.nttdocomo.co.jp/service/imode/make/content/pictograph/#{x}/index.html" table += parse(URI(uri).read.toutf8) end open(File.dirname(__FILE__)+"/../lib/jpmobile/emoticon/docomo.rb","w") do |f| f.puts "Jpmobile::Emoticon::DOCOMO_SJIS_TO_UNICODE = {" table.each do |row| f.puts " 0x%s=>0x%s, "%[row[1], row[3]] end f.puts "}.freeze" f.puts "Jpmobile::Emoticon::DOCOMO_UNICODE_TO_SJIS = Jpmobile::Emoticon::DOCOMO_SJIS_TO_UNICODE.invert.freeze" end
Version data entries
105 entries across 95 versions & 1 rubygems