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

About this user

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

use ruby to scrape a url

// 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
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS