Skip to content

Instantly share code, notes, and snippets.

@hnprashanth
Created February 10, 2012 06:17
Show Gist options
  • Save hnprashanth/1787140 to your computer and use it in GitHub Desktop.
Save hnprashanth/1787140 to your computer and use it in GitHub Desktop.
Simple Flipkart scraper
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
@dayanand-sourcebits
Copy link

Its simple but can be made more interesting with pagination crawling etc. is it some preparations for barcamp? :P

@hnprashanth
Copy link
Author

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