8 "/Volumes/uploader/src/mmdbowl/bowlroll.atom"
12 http = Net::HTTP.new('bowlroll.net')
14 http.request_get('/feed/up?feed=ATOM&count=20&tab=MikuMikuDance') do |response|
15 open(rss_path, 'wb') { |f|
16 response.read_body { |buf| f.write buf }
22 def self.each_code_in_rss
23 feed = RSS::Parser.parse(IO.read(rss_path))
24 feed.items.each do |item|
25 code = /(dl\d+)\z/.match(item.link.href)[1]
31 "/Volumes/uploader/src/mmdbowl/#{code}.html"
35 http = Net::HTTP.new('bowlroll.net')
37 http.request_get("/up/#{code}") do |response|
38 open(src_path, 'wb') { |f|
39 response.read_body { |buf| f.write buf }
46 if File.exist? src_path
64 @source = IO.read(src_path)
68 !!/削除されました/.match(@source)
72 !!/アクセス制限が/.match(@source)
76 !!/認証キーを入力/.match(@source)
80 %r(<meta property="og:title" content="(.+?)">).match(@source)[1]
84 keywords.split(/,/)[1..-1]
88 %r(<meta name="keywords" content="(.+?)">).match(@source)[1]
92 %r(<meta name="description" content="(.+?)">).match(@source)[1]
96 File.extname(origname)[1..-1]
100 %r(<h3><b>ファイル名</b> : (.+?)</h3>).match(@source)[1]
109 header["user-agent"] = "Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)"
110 header["accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
111 header["accept-language"] = "ja,en-us;q=0.7,en;q=0.3"
112 header["accept-charset"] = "Shift_JIS,utf-8;q=0.7,*;q=0.7"
113 header["referer"] = "http://bowlroll.net/up/#{code}"
114 # header["content-type"] = "multipart/form-data; boundary=#{boundary}"
119 "upDlVal=&upDlNum=#{number}"
123 /dl(\d+)/.match(code)[1].to_i
131 "/Volumes/uploader/arc/mmdbowl/#{name}"
136 http = Net::HTTP.new('bowlroll.net')
138 request = Net::HTTP::Post.new('/Php/p3UpDlTop.php')
140 request_header.each do |key, value|
143 request.body = request_body
145 http.request(request) do |response|
147 p response['content-type']
148 response_code = response.code.to_i
149 if response_code == 200
150 open(arc_path, 'wb') { |f|
151 response.read_body { |buf| f.write buf }
160 if removed? || denied? || locked?
163 if File.exist? arc_path