# Scanweb. Rb
# Use Ruby scanweb. RB www.jb51.net to save the current result in c: \ 1.txt
Require 'net/http'
Filename = file. New ('C: \ 1.txt ', "W + ")
If $ * [0] = Nil
Puts "hehe, no URL entered"
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
# Bored: There are vbs, PHP, and Ruby versions. It seems that Ruby is faster than vbs and comparable to PhP.
= Begin
Modify
Require 'net/http'
Filename = file.new('1.txt ', "W + ")
If $ * [0] = Nil
Abort "usage example: Ruby #$0 www.sohu.com, set the result to the current directory 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