Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

use ruby to scrape a url (See related posts)

// description of your code here

require 'open-uri'
cmdStr1="wget http://www..... -q -O test1.html --load-cookies=cookies.txt"

# system cmdStr1
searchURI = "test1.html"
open(searchURI) do |f|
fileText=f.read
puts fileText
r1=Regexp.new('<title>(.*?)<')
uname = fileText.scan(r1)
puts [uname[0]].join(" ")
end
# end user loop

You need to create an account or log in to post comments to this site.


Click here to browse all 5140 code snippets

Related Posts