merge upstream

Colors on Non valids. Check msg.to.id and msg.from.id
function load_from_file(file)
vardump uses serpent
tabs on scandir
Failed on Free games (no price info)
Google with unescaped URLs
This commit is contained in:
2015-04-26 19:16:44 +02:00
parent 94fea4e9aa
commit fe78a49367
5 changed files with 73 additions and 65 deletions

View File

@ -1,14 +1,18 @@
function googlethat(query)
local api = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&"
local api = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&safe=active&hl=de&"
local parameters = "q=".. (URL.escape(query) or "")
-- Do the request
local res, code = https.request(api..parameters)
if code ~=200 then return nil end
local data = json:decode(res)
local results={}
for key,result in ipairs(data.responseData.results) do
table.insert(results,{result.titleNoFormatting, result.url})
table.insert(results, {
result.titleNoFormatting,
result.unescapedUrl or result.url
})
end
return results
end
@ -22,9 +26,8 @@ function stringlinks(results)
end
function run(msg, matches)
vardump(matches)
local results = googlethat(matches[1])
return stringlinks(results)
local results = googlethat(matches[1])
return stringlinks(results)
end
return {