08/07/11 19:29:40 CcCt/Y8G0
ながすぎたお。
#! /usr/bin/ruby -Ku
require 'nkf'
require 'open-uri'
threaddata=open("URLリンク(pc11.2ch.net)").read
threaddata=NKF.nkf('-Sw',threaddata)
threadsmnums = threaddata.scan(/watch¥/([^¥/^¥.]+?#{ARGV[1]}[0-9]+)/).flatten|[]
resnum=[]
threadsmnums.each{|movnum|
linenum=1
temp=[]
threaddata.each_line{|s|
if s.scan(movnum)!=[]
temp<< linenum
end
linenum=linenum+1
}
resnum<<temp
}
resnum=resnum|[]
resnum.each{|s|
puts ">>#{s.join(",")}"
}
f = open("thums.html", "w")
threadsmnums.each{|s|
f.puts "<iframe width=¥"310¥" height=¥"205¥" src=¥"http:¥/¥/www¥.nicovideo¥.jp¥/thumb¥/#{s}
¥" scrolling=¥"no¥" style=¥"border:solid 1px #CCC;¥" frameborder=¥"0¥"><¥/iframe>"
}
f.close
`open thums.html`