1: 2003-12-04 (木) 23:09:00 |
現: 2024-01-08 (月) 12:58:49 ゲスト |
| *スクリプト | | *スクリプト |
| #!/usr/local/bin/ruby | | #!/usr/local/bin/ruby |
| + | |
| require 'net/http' | | require 'net/http' |
| require 'cgi' | | require 'cgi' |
| + | |
| cgi = CGI.new | | cgi = CGI.new |
| par = [] | | par = [] |
| todaystr = Time.now.strftime("%Y%m%d") | | todaystr = Time.now.strftime("%Y%m%d") |
| a = true | | a = true |
| + | |
| Dir.glob("\.\/????????.txt").each do |f| | | Dir.glob("\.\/????????.txt").each do |f| |
| if "./#{todaystr}.txt" == f then | | if "./#{todaystr}.txt" == f then |
| end | | end |
| end | | end |
| + | |
| + | sv = 'www2.hideyosi.com' |
| + | tp = '/~hideyosi_m/osask_ml/' |
| + | # sv = 'www.afis.to' |
| + | # tp = '/~mone/osask/osask_ml/' |
| + | |
| if a then | | if a then |
- | | + | |
- | Net::HTTP.start( 'www.afis.to', 80 ) {|http| | + | Net::HTTP.start( sv , 80 ) {|http| |
- | response , = http.get('/~mone/osask/osask_ml/index.html') | + | response , = http.get(tp) |
| response.body.split("\n").each{|pul| | | response.body.split("\n").each{|pul| |
| if /HREF=\"(\d{6})\/\"\>/ =~ pul then | | if /HREF=\"(\d{6})\/\"\>/ =~ pul then |
| } | | } |
| } | | } |
| + | |
| open("./#{todaystr}.txt", "w") do |f| | | open("./#{todaystr}.txt", "w") do |f| |
| par.each { |pname| | | par.each { |pname| |
- | Net::HTTP.start( 'www.afis.to', 80 ) {|http| | + | Net::HTTP.start( sv, 80 ) {|http| |
- | response , = http.get("/~mone/osask/osask_ml/#{pname}/index.html") | + | response , = http.get("#{tp}#{pname}/index.html") |
| response.body.split("\n").each{|pul| | | response.body.split("\n").each{|pul| |
| if /HREF=\"msg(\d{5})\.html\"\>\[(?:OSASK|osask) (\d+)\] (.+)\<\/A\>/ =~ pul then | | if /HREF=\"msg(\d{5})\.html\"\>\[(?:OSASK|osask) (\d+)\] (.+)\<\/A\>/ =~ pul then |
- | surl = "http://www.afis.to/~mone/osask/osask_ml/#{pname}/msg#{$1}.html" | + | surl = "#{pname}/msg#{$1}.html" |
| smid = "[OSASK #{$2}]" | | smid = "[OSASK #{$2}]" |
| smti = "#{$3}" | | smti = "#{$3}" |
| end | | end |
| end | | end |
| + | |
| returl = "" | | returl = "" |
| inn = cgi['n'].to_s | | inn = cgi['n'].to_s |
| + | |
| if inn then | | if inn then |
| open("./#{todaystr}.txt") do |f| | | open("./#{todaystr}.txt") do |f| |
| end | | end |
| end | | end |
| + | |
| if returl != "" then | | if returl != "" then |
- | print cgi.header({"Location" => returl }) | + | print cgi.header({"Location" => "http://#{sv}#{tp}#{returl}" }) |
| print "転送 >> #{returl}" | | print "転送 >> #{returl}" |
| else | | else |
| cgi.out{"みつからない~ぐへぇ・・・"} | | cgi.out{"みつからない~ぐへぇ・・・"} |
| end | | end |
| + | |
| | | |
| *何に使うんだ? | | *何に使うんだ? |
| | | |
| WikiからML発言ナンバーでリンクしたくて・・・それだけです。・・・最近Rubyネタばっかりだな 笑 | | WikiからML発言ナンバーでリンクしたくて・・・それだけです。・・・最近Rubyネタばっかりだな 笑 |
| + | -こんなおもしろそうなのがあったとは!見落としていたニョ! ・・・これ、つかっちゃっていいんだよねぇ? だれが作ったページだろ? nisiさん? -- ''hideyosi'' &new{2006-03-25 (土) 22:46:00}; |
| + | |
| + | #comment |