Maybe it's time for a change...
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
set theQuery to "AppleScriptObjC"
-- build and escape query string
set theQuery to current application's NSString's stringWithString:theQuery
set theQuery to theQuery's stringByReplacingOccurrencesOfString:space withString:"+"
set escQuery to theQuery's stringByAddingPercentEncodingWithAllowedCharacters:(current application's NSCharacterSet's URLQueryAllowedCharacterSet())
-- do search
set theURL to current application's NSURL's URLWithString:searchURLString
set {theData, theError} to current application's NSData's dataWithContentsOfURL:theURL options:0 |error|:(reference)
if theData = missing value then error (theError's localizedDescription() as text)
-- convert to XML
set {theXMLDoc, theError} to current application's NSXMLDocument's alloc()'s initWithData:theData options:(current application's NSXMLDocumentTidyHTML) |error|:(reference)
if theXMLDoc = missing value then error (theError's localizedDescription() as text)
-- filter via XPath and predicate
set xpathStr to "//*[@class=\"r\"]/a/@href"
set {theNodes, theError} to theXMLDoc's nodesForXPath:xpathStr |error|:(reference)
if theNodes = missing value then error (theError's localizedDescription() as text)
set nodeStrings to (theNodes's valueForKey:"stringValue")
set thePred to current application's NSPredicate's predicateWithFormat:"self BEGINSWITH '/url?q='"
set nodeStrings to nodeStrings's filteredArrayUsingPredicate:thePred
-- trim URL strings
set theURLStrings to {}
repeat with aString in nodeStrings
set theOffset to (aString's rangeOfString:"&")
set end of theURLStrings to (aString's substringWithRange:{7, (theOffset's location) - 7}) as text
end repeat
return theURLStrings
(*
--> {
}
*)