Update giphy.lua
This commit is contained in:
parent
84b7062aed
commit
5c38c4842f
@ -15,7 +15,10 @@ function get_random_top()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function search(text)
|
function search(text)
|
||||||
local res, code = http.request(BASE_URL.."/gifs/search?q="..text.."&api_key="..API_KEY)
|
text = URL.escape(text)
|
||||||
|
local url = BASE_URL.."/gifs/search?q="..text.."&api_key="..API_KEY
|
||||||
|
print(url)
|
||||||
|
local res, code = http.request(url)
|
||||||
if code ~= 200 then return nil end
|
if code ~= 200 then return nil end
|
||||||
local images = json:decode(res).data
|
local images = json:decode(res).data
|
||||||
if #images == 0 then return nil end -- No images
|
if #images == 0 then return nil end -- No images
|
||||||
|
Reference in New Issue
Block a user