From 7581f32fa449e02f1429fa69fb2ac071c0334bdf Mon Sep 17 00:00:00 2001 From: Jinks Date: Sat, 24 Oct 2015 03:48:03 +0200 Subject: [PATCH] Deal with stupid responses from Google's YT API --- plugin/youtube.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/youtube.lua b/plugin/youtube.lua index 657b9b6..03ea28a 100644 --- a/plugin/youtube.lua +++ b/plugin/youtube.lua @@ -6,7 +6,7 @@ local function fetch_title (videoid) --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 j = json.decode(r) - if j then + if j and next(j.items) then return j.items[1].snippet.title end end