欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ruby寫掃描當(dāng)前網(wǎng)頁所有url的腳本

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

#用法ruby scanweb.rb www.dbjr.com.cn 將當(dāng)前結(jié)果保存在c:\1.txt

require 'net/http'
filename= File.new('c:\1.txt',"w+")
if $*[0]==nil 
puts "hehe,沒有輸入網(wǎng)址"
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 ,結(jié)果放在當(dāng)前目錄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

相關(guān)文章

最新評論