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

   1  
   2  require 'open-uri'
   3  cmdStr1="wget http://www..... -q -O test1.html --load-cookies=cookies.txt"
   4  
   5  # system cmdStr1
   6  searchURI = "test1.html"
   7  open(searchURI) do |f|
   8  fileText=f.read
   9  puts fileText
  10  r1=Regexp.new('<title>(.*?)<')
  11  uname = fileText.scan(r1)
  12  puts [uname[0]].join(" ")
  13  end
  14  # end user loop
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS