tylerpearson / lazyYT

A jQuery plugin to lazy load those dang Youtube iframe videos.
Other
208 stars 86 forks source link

gdata.youtube.com No longer available #56

Open luke-robinson opened 8 years ago

luke-robinson commented 8 years ago

Google reports gdata.youtube.com is no longer available. Returns a 404 when requested by lazyYT.

$.getJSON('//gdata.youtube.com/feeds/api/videos/' + id + '?v=2&alt=json', function (data) { $el.find('#lazyYT-title-' + id).text(data.entry.title.$t); });

BuXXe commented 8 years ago

This is due to the deprecation of Youtube API version 2. The current version (v3) uses a method which includes API-Keys. This would be the v3 version of the call: https://www.googleapis.com/youtube/v3/videos?id={VIDEO ID}&part=contentDetails&key={YOUR_API_KEY}.

This means that the plugins needs to know your api key and use the new request. This should fix the issue. The newest version of the plugin takes care of this so just be sure to get an API Key and use it during setup of LazyYT. (further reading: https://github.com/tylerpearson/lazyYT/issues/34)

adonisamitsah commented 4 years ago

Use This Instead

$.getJSON('https://noembed.com/embed', {format: 'json', url: 'https://www.youtube.com/watch?v=' + id}, function (data) { $el.find('#lazyYT-title-' + id).text(data.title); });