Fixed youtube thumbnails

API v2 got deprecated in March and v3 requires signup. Hotlinking like a
boss.
This commit is contained in:
Marcin Kurczewski 2014-06-20 17:04:42 +02:00
parent d45da1e0ae
commit da9765c352

View file

@ -203,13 +203,8 @@ $(function()
if (matches = url.match(/watch.*?=([a-zA-Z0-9_-]+)/)) if (matches = url.match(/watch.*?=([a-zA-Z0-9_-]+)/))
{ {
postDom.find('.file-name strong').text(url); postDom.find('.file-name strong').text(url);
var url = 'http://gdata.youtube.com/feeds/api/videos/' + matches[1] + '?v=2&alt=jsonc'; var realUrl = 'http://img.youtube.com/vi/' + matches[1] + '/mqdefault.jpg';
getJSON({ url: url }).success(function(data) changeThumb(postDom.find('img'), realUrl);
{
postDom.find('.file-name strong')
.text(data.data.title);
changeThumb(postDom.find('img'), data.data.thumbnail.hqDefault);
});
} }
else else
{ {