 htmlStrip = require 'htmlstrip-native'
 
 SEARCH_URL = 'https://www.google.com/search'
-# this gets the correct page structure, needs to be slimmed down
-USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/34.0.1847.116 Chrome/34.0.1847.116 Safari/537.36'
+USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36'
+#Rommie=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1309.0 Safari/537.17
 
 module.exports = (robot) ->
   getQueryUrl = (version, query) ->

      if !version?
        version = ''
      else if version.length > 1
        version = version.replace(/[\.]/g, "-")
        version = version.substr(0, 3)
      else if version == '4'
        version = ''

    fetchResult getQueryUrl(version, query), (url) ->
      response = url
      if user
        response = user + ": " + response

      if version == 'php' and /function/.test url
        robot.http(url).get() (err, res, body) ->
          $ = cheerio.load body
          methodSigContent = htmlStrip.html_strip $('.methodsynopsis').html(), compact_whitespace : true
          msg.send response + " | #{methodSigContent}"
      else
        if !url
          msg.send "No results for \"#{query}\""
        else
          msg.send response

#   LioBot gets you tip top information from the Laravel or PHP documentation
#
# Commands:
#   <nick?> !docs <version?> <query> - Perform a Google search against Laravel or PHP
#       docs for <query>, version can be a numeric version number, 'api' to
#       search the api docs, 'php' to search the PHP docs, or blank for
#       the latest Laravel docs pages.
