2 # vim: fileencoding=utf-8
6 str && NKF.nkf('-Sw', str)
9 def encode_to_sjis(str)
10 str && NKF.nkf('-Ws', str)
13 location = ARGV.shift || 'mmd'
14 ent = "/Volumes/uploader/src/#{location}/index.html"
18 row_re = %r(</td><td><a href="(.+?)">(.+?)</a></td><td>(.+?)</td><td>(.+?)</td><td>(.+?)</td><td>(.+?)</td><td>(.+?)</td></tr>)
19 key_re = Regexp.new(Regexp.escape("<font color=\"#FF0000\">[DLKey] </font>"))
20 password_re = Regexp.new(Regexp.escape("<font color=\"#FF0000\">*</font>"))
23 if md = row_re.match(line)
24 _, href, name, comment, size, date, mime, orig = md.to_a
25 comment.sub!(key_re, '')
26 comment.sub!(password_re, '')
27 puts [ name, comment, size, date, orig ].join("\t")
31 row_re = %r(<td>\[<a href="(.+?)" >(.+?)</a>\]</td><td>(.+?) <a href="(?:.+?)">(?:.+?)</a></td><td class="size">(.+?)</td><td class="date">(.+?)</td><td class="orig"><span class="orig">(.+?)</span></td>)
32 key_re = Regexp.new(Regexp.escape("<strong class=\"key\">[P]</strong> "))
35 if md = row_re.match(line)
36 _, href, name, comment, size, date, orig = md.to_a
37 comment.sub!(key_re, '')
38 puts [ name, comment, size, date, orig ].join("\t")
42 row_re = %r(<td align=center>\[<a href='(.+?)' target='_new'>(.+?)</a>\]</td><td>(.+?)</td><td align=right>(.+?)</td><td align=center>(.+?)</td><td>(.+))
45 if md = row_re.match(line)
46 _, href, name, comment, size, date, orig = md.to_a
47 puts [ name, encode(comment), size, date, encode(orig) ].join("\t")
51 row_re = %r(</td><td><a href="(.+?)">(.+?)</a></td><td>(.+?)</td><td>(.+?)</td><td>(.+?)</td><td class="down_max">(.+?)</td></tr>)
52 key_re = Regexp.new(Regexp.escape(encode_to_sjis("<font color=\"#FF0000\">[パス設定] </font>")))
55 if md = row_re.match(line)
56 _, href, name, comment, size, date = md.to_a
57 comment.sub!(key_re, '')
58 puts [ name, encode(comment), size, encode(date) ].join("\t")