Merge pull request #183 from nickago/MM-1073

MM-1073 Enable youtube metadata with a google developer key
Этот коммит содержится в:
Joram Wilander
2015-07-16 18:06:16 -04:00
родитель a2ba1615d3 c1e23faab7
Коммит 3f328546f8
2 изменённых файлов: 19 добавлений и 8 удалений

Просмотреть файл

@@ -303,18 +303,25 @@ var getYoutubeEmbed = function(link) {
}; };
var success = function(data) { var success = function(data) {
$('.video-uploader.'+youtubeId).html(data.data.uploader); if(!data.items.length || !data.items[0].snippet) {
$('.video-title.'+youtubeId).find('a').html(data.data.title); return;
}
var metadata = data.items[0].snippet;
$('.video-uploader.'+youtubeId).html(metadata.channelTitle);
$('.video-title.'+youtubeId).find('a').html(metadata.title);
$(".post-list-holder-by-time").scrollTop($(".post-list-holder-by-time")[0].scrollHeight); $(".post-list-holder-by-time").scrollTop($(".post-list-holder-by-time")[0].scrollHeight);
$(".post-list-holder-by-time").perfectScrollbar('update'); $(".post-list-holder-by-time").perfectScrollbar('update');
}; };
if(config.GoogleDeveloperKey) {
$.ajax({ $.ajax({
async: true, async: true,
url: 'https://gdata.youtube.com/feeds/api/videos/'+youtubeId+'?v=2&alt=jsonc', url: "https://www.googleapis.com/youtube/v3/videos",
type: 'GET', type: 'GET',
data: {part:"snippet", id:youtubeId, key:config.GoogleDeveloperKey},
success: success success: success
}); });
}
return ( return (
<div className="post-comment"> <div className="post-comment">

Просмотреть файл

@@ -16,6 +16,10 @@ var config = {
RequireInviteNames: false, RequireInviteNames: false,
AllowSignupDomainsWizard: false, AllowSignupDomainsWizard: false,
// Google Developer Key (for Youtube API links)
// Leave blank to disable
GoogleDeveloperKey: "",
// Privacy switches // Privacy switches
ShowEmail: true, ShowEmail: true,