Skip to content

Commit

Permalink
Now img_google choose the unescapedURL if exist
Browse files Browse the repository at this point in the history
  • Loading branch information
rockneurotiko committed Jun 21, 2015
1 parent a727ce8 commit ca84751
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/img_google.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ local function simple_google_table(google)
local results = google.responseData.results
for k,result in pairs(results) do
new_table.responseData.results[k] = {}
new_table.responseData.results[k].unescapedUrl = result.unescapedUrl
new_table.responseData.results[k].url = result.url
end
return new_table
Expand Down Expand Up @@ -82,7 +83,7 @@ local function process_google_data(google, receiver, query)

-- Random image from table
local i = math.random(#data.results)
local url = data.results[i].url
local url = data.results[i].unescapedUrl or data.results[i].url
local old_timeout = http.TIMEOUT or 10
http.TIMEOUT = 5
send_photo_from_url(receiver, url)
Expand Down Expand Up @@ -118,4 +119,4 @@ return {
run = run
}

end
end

0 comments on commit ca84751

Please sign in to comment.