亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

ruby寫掃描當前網頁所有url的腳本

 更新時間:2008年06月25日 21:00:36   作者:  
用ruby寫的掃描當前網頁所有url的腳本,對于學習ruby的朋友是個不錯的實例
#scanweb.rb

#用法ruby scanweb.rb chabaoo.cn 將當前結果保存在c:\1.txt

require 'net/http'
filename= File.new('c:\1.txt',"w+")
if $*[0]==nil 
puts "hehe,沒有輸入網址"
else
h = Net::HTTP.new($*[0], 80)
resp, data = h.get('/index.html', nil)
if resp.message == "OK"
data.scan(/<a href="(.*?)"/).each do |x|
puts x
filename.puts x
end
end
end

#無聊,有vbs、php、ruby版了,好像ruby比vbs快,與php不相上下。

=begin

修改一下

require 'net/http'
filename= File.new('1.txt',"w+")
if $*[0]==nil 
abort "用法示例:ruby #$0 www.sohu.com ,結果放在當前目錄1.txt" 
end

h = Net::HTTP.new($*[0], 80)

resp, data = h.get('/index.html', nil)
if resp.message == "OK"
data.scan(/<a href="(.*?)"/).each do |x|
puts x
filename.puts x
end
end

=end

相關文章

最新評論