Skip to content

Instantly share code, notes, and snippets.

@5hanth
Created March 18, 2017 18:50
Show Gist options
  • Save 5hanth/58bca01a4d3a927eecb977a91d12de20 to your computer and use it in GitHub Desktop.
Save 5hanth/58bca01a4d3a927eecb977a91d12de20 to your computer and use it in GitHub Desktop.
Vegetable Price Chennai
#! /usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open('http://www.livechennai.com/Vegetable_price_chennai.asp'))
table = doc.css("table.table-price tr")
parse = -> (i) { i.css('td').drop(1).map{|j| j.css('p')[0].content.strip.chop.strip}.join }
puts table.drop(1).map(&parse)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment