2007/09/15 (土) 16:10:52        [qwerty]
require 'uri'
require 'open-uri'
require 'nkf'

open("song.txt").read.each {|i|
  $KCODE = 'EUC'
  title = URI.escape(i.chomp)
  NKF.nkf("-s", open("http://m.search.music.yahoo.co.jp//bin/lyricssearch?cc=fs&cp=#{title}&cc=ss").read) \
    .scan(/music.yahoo.co.jp\/shop\/p\/53\/(.*?)\\"/)
  if $1 == nil
    next
  end
  dat = $1.split(/\//)

  print NKF.nkf("-s", open("http://music.yimg.jp/bin/sendlyricstext?ArtistId=#{dat[0]}&Id=#{dat[1]}").read) \
    .gsub(/LYRICS=<p align="center">/, '').gsub(/<.?b>/, '').gsub(/<br>/, "\n"), "\n\n"
}

song.txtってのに1行ずつ曲名を並べるんだ