Module: QuickScrapper

Defined in:
lib/quick_scrapper.rb,
lib/quick_scrapper/version.rb

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.scrap(url, selector) ⇒ Object

Scraps the selection associated to css_selector selector from the page located at url

Example: QuickScrapper.scrap(“bvsatyaram.com”, div.priceAvail>div>div.PriceCompare>div.BodyS“)



7
8
9
10
11
12
13
14
15
# File 'lib/quick_scrapper.rb', line 7

def self.scrap(url, selector)
  scraper = Scraper.define do
    process selector, :selection => :text
    result :selection
  end

  uri = URI.parse(url)
  return scraper.scrape(uri)
end