Created
February 10, 2012 06:17
-
-
Save hnprashanth/1787140 to your computer and use it in GitHub Desktop.
Simple Flipkart scraper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
#Flipkart search URL to scrape | |
url = "http://www.flipkart.com/search-mobiles?query=galaxy&from=all" | |
doc = Nokogiri::HTML(open(url)) | |
puts doc.at_css("title").text | |
doc.css(".fk-inf-scroll-item").each do |item| | |
title = item.at_css(".fk-srch-title-text").text | |
price = item.at_css(".final-price").text | |
puts title + price | |
end |
I was just playing with Nokigiri, what a gem. And no, this has nothing to do with Barcamp :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Its simple but can be made more interesting with pagination crawling etc. is it some preparations for barcamp? :P