Google hourly hot trends on command line

Well, /me back to pawing at Google from CLI, after few silly apps like getting the weather, news, sunrise and sets from terminal from me, again tonight before I hit the bed, did a silly ruby code to get the hourly hot trends on the CLI.

Even though the page had CDATA in it, ignored it fully, rather took advantage of it with nokogiri in ruby to get them all.

All you have to do is install the nokogiri gem and then try the tiny little script presented below.

gem install nokogiri and then the below code. (Shall we call it one liner ;) ?)

require 'nokogiri'
require 'open-uri'   
hot_url = ''
page = Nokogiri::HTML(open(hot_url))
p page.css('li').each {|x| p x.text}

Hot trends when I ran the script :

"Robin Roberts"
"LA Kings"
"Pirate Bay"
"True Blood"
"Tony Awards"
"Miami Heat"
"Tina Turner"
"Pacquiao vs Bradley"
"Madagascar 3"
"Lindsay Lohan"
"Belmont Stakes 2012"
"Creflo Dollar"
"French Open"
"Euro 2012"
"Miami Heat"
"Lil Phat"
"Bob Welch"
Share this