From 9e722dad721f8492721860e519554f69e2ee36a0 Mon Sep 17 00:00:00 2001 From: mfridge Date: Mon, 26 Oct 2015 00:24:32 +0100 Subject: [PATCH] Get video title using youtube api v3 Youtube api v2 is deprecated. Plugin was not able to get the video title. In api v3 a personal api key is needed. --- lazyYT.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lazyYT.js b/lazyYT.js index 2db05ff..f8f52d3 100644 --- a/lazyYT.js +++ b/lazyYT.js @@ -105,6 +105,10 @@ $.getJSON('//gdata.youtube.com/feeds/api/videos/' + id + '?v=2&alt=json', function (data) { $el.find('#lazyYT-title-' + id).text(data.entry.title.$t); }); + // Youtube API v3 key is needed to query the video title. See here how to obtain an api key: https://developers.google.com/youtube/v3/getting-started + $.getJSON('//www.googleapis.com/youtube/v3/videos?id=' + id + '&key=&fields=items(snippet(title))&part=snippet', function (data) { + $el.find('#lazyYT-title-' + id).text(data.items[0].snippet.title); + }); }