Permalink
Browse files

Added comments to goog method

  • Loading branch information...
1 parent 040a73f commit ad84c2374aef6e2aeb3665e7acb6021e9f2e4c7f @hemanth committed Nov 6, 2010
Showing with 2 additions and 0 deletions.
  1. +2 −0 rgbot.rb
View
@@ -67,6 +67,8 @@ def l33t(msg)
end
def goog(msg)
+ # This method used the google ajax search API which returns and JSON, that is parsed to get the first url
+ # This is a linear implementation of I'm feeling lucky search
gurl = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q="+URI.escape(@msg.body, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
self.deliver(@msg,JSON.parse(Net::HTTP.get_response(URI.parse(gurl)).body)['responseData']['results'][0]['url'])
end

0 comments on commit ad84c23

Please sign in to comment.