How I can read the JSON with luvit? I tried using
http = require 'http'
json = http.parseUrl('https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCQmWt938Z8TkdPq6uasdlbA&type=video&eventType=live&key=[API_KEY]')
print(json)
The output I wanted to be was:
{
"kind": "youtube#searchListResponse",
"etag": "sFrPwpP_AW_VDxRSD3nOMOJhmmo",
"regionCode": "BR",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 5
},
"items": []
}
but instead, I get a table
Hey guys i realized how to do this
coro = require'coro-http'
local link = 'https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCgSAH94ZjV6-w46hPJ0-ffQ&type=video&eventType=live&key=[API_KEY]'
coroutine.wrap(function ()
result, body = coro.request('GET', link)
p(body)
end)()
the input
'{\n "kind": "youtube#searchListResponse",\n "etag": "sFrPwpP_AW_VDxRSD3nOMOJhmmo",\n "regionCode": "BR",\n "pageInfo": {\n "totalResults": 0,\n "resultsPerPage": 5\n },\n "items": []\n}\n'