Deal with stupid responses from Google's YT API
This commit is contained in:
parent
ebd4a30c70
commit
7581f32fa4
1 changed files with 1 additions and 1 deletions
|
@ -6,7 +6,7 @@ local function fetch_title (videoid)
|
||||||
--local response = {}
|
--local response = {}
|
||||||
local r,c,h = https.request("https://www.googleapis.com/youtube/v3/videos?id="..videoid.."&key="..yt_api_key.."&part=snippet&fields=items(snippet(title))")
|
local r,c,h = https.request("https://www.googleapis.com/youtube/v3/videos?id="..videoid.."&key="..yt_api_key.."&part=snippet&fields=items(snippet(title))")
|
||||||
local j = json.decode(r)
|
local j = json.decode(r)
|
||||||
if j then
|
if j and next(j.items) then
|
||||||
return j.items[1].snippet.title
|
return j.items[1].snippet.title
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue