Created
August 31, 2013 08:16
-
-
Save jikkujose/6396890 to your computer and use it in GitHub Desktop.
Simple script in Ruby to get Google's suggested search terms
This file contains hidden or 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
#! /usr/bin/env ruby | |
require 'open-uri' | |
require 'nokogiri' | |
google_query_url = 'http://www.google.co.in/search?&q=' | |
search_query = 'drath note' | |
if ARGV.length == 0 then | |
puts "usage: suggest <approx> <wrds> <to> <srch>" | |
exit | |
end | |
search_query = ARGV.join('+') | |
search_url = google_query_url + search_query | |
# puts "Search url: " + search_url | |
search_page = open( search_url ).read() | |
google_suggest = Nokogiri::HTML( search_page ).css('#topstuff span.spell + a').text | |
puts google_suggest unless google_suggest.length == 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment