From ca84751dd4aa7e559df6fac766995b0062fec983 Mon Sep 17 00:00:00 2001 From: Rock Neurotiko Date: Sun, 21 Jun 2015 22:22:47 +0200 Subject: [PATCH] Now img_google choose the unescapedURL if exist --- plugins/img_google.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/img_google.lua b/plugins/img_google.lua index 30f655e7..6d5d8900 100644 --- a/plugins/img_google.lua +++ b/plugins/img_google.lua @@ -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 @@ -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) @@ -118,4 +119,4 @@ return { run = run } -end \ No newline at end of file +end