diff --git a/plugins/domains/dribbble.com.js b/plugins/domains/dribbble.com.js index 77ade2ec2..14f4285a9 100644 --- a/plugins/domains/dribbble.com.js +++ b/plugins/domains/dribbble.com.js @@ -45,7 +45,7 @@ export default { links.push({ href: twitter.player.value, type: CONFIG.T.text_html, - rel: [CONFIG.R.player, CONFIG.R.gifv], + rel: CONFIG.R.player, 'aspect-ratio': twitter.player.width / twitter.player.height, }) } diff --git a/plugins/domains/facebook.com/facebook.thumbnail.js b/plugins/domains/facebook.com/facebook.thumbnail.js index d97c99f87..a8e18318a 100644 --- a/plugins/domains/facebook.com/facebook.thumbnail.js +++ b/plugins/domains/facebook.com/facebook.thumbnail.js @@ -12,8 +12,6 @@ export default { 'facebook.video' ], - mixins: ['facebook.meta-fallback'], - getLink: function(url, __allowFBThumbnail, options, meta) { var thumbnail = meta.twitter?.image @@ -77,6 +75,5 @@ export default { tests: [{ noFeeds: true, skipMethods: ['getData', 'getLink'], - skipMixins: ['facebook.meta-fallback'] }] }; \ No newline at end of file diff --git a/plugins/domains/youtube.com/youtube.video.js b/plugins/domains/youtube.com/youtube.video.js index e60c23068..2c9167dfd 100644 --- a/plugins/domains/youtube.com/youtube.video.js +++ b/plugins/domains/youtube.com/youtube.video.js @@ -68,12 +68,11 @@ export default { return cb(error); } - if (data && data.items && data.items.length > 0) { - + if (data?.items?.length > 0) { var entry = data.items[0]; var duration = 0; - var durationStr = entry.contentDetails && entry.contentDetails.duration; + var durationStr = entry.contentDetails?.duration; if (durationStr) { var m = durationStr.match(/(\d+)S/); if (m) { @@ -91,22 +90,24 @@ export default { var gdata = { id: urlMatch[1], - title: entry.snippet && entry.snippet.title, - uploaded: entry.snippet && entry.snippet.publishedAt, - uploader: entry.snippet && entry.snippet.channelTitle, - channelId: entry.snippet && entry.snippet.channelId, - description: entry.snippet && entry.snippet.description, - likeCount: entry.statistics && entry.statistics.likeCount, - dislikeCount: entry.statistics && entry.statistics.dislikeCount, - viewCount: entry.statistics && entry.statistics.viewCount, - - hd: entry.contentDetails && entry.contentDetails.definition === "hd", - playerHtml: entry.player && entry.player.embedHtml, + title: entry.snippet?.title, + uploaded: entry.snippet?.publishedAt, + uploader: entry.snippet?.channelTitle, + channelId: entry.snippet?.channelId, + description: entry.snippet?.description, + likeCount: entry.statistics?.likeCount, + dislikeCount: entry.statistics?.dislikeCount, + viewCount: entry.statistics?.viewCount, + + hd: entry.contentDetails?.definition === "hd", + playerHtml: entry.player?.embedHtml, embeddable: entry.status ? entry.status.embeddable : true, - uploadStatus: entry.status && entry.status.uploadStatus + uploadStatus: entry.status?.uploadStatus, + status: entry.status, + ytRating: entry.contentDetails?.contentRating?.ytRating }; - if (entry.snippet && entry.snippet.thumbnails) { + if (entry.snippet?.thumbnails) { gdata.thumbnails = entry.snippet.thumbnails; } @@ -117,7 +118,7 @@ export default { if (gdata.uploadStatus === "rejected") { cb({ responseStatusCode: 410, - message: "The video has been removed. Reason: " + (entry.status && entry.status.rejectionReason || 'not given') + message: "The video has been removed. Reason: " + (entry.status?.rejectionReason || 'not given') }); } else { cb(null, { @@ -146,6 +147,7 @@ export default { likes: youtube_video_gdata.likeCount, dislikes: youtube_video_gdata.dislikeCount, views: youtube_video_gdata.viewCount, + warning: youtube_video_gdata.ytRating === 'ytAgeRestricted' ? 'age': null, site: "YouTube", canonical: "https://www.youtube.com/watch?v=" + youtube_video_gdata.id, author_url: "https://www.youtube.com/" + (youtube_video_gdata.channelId ? "channel/" + youtube_video_gdata.channelId : "user/" + youtube_video_gdata.uploader) @@ -202,7 +204,7 @@ export default { // https://developers.google.com/youtube/player_parameters#cc_load_policy var cc_load_policy = options.getRequestOptions('youtube.cc_load_policy', params.cc_load_policy); if (cc_load_policy) { - params.cc_load_policy = '1'; + params.cc_load_policy = 1; } else if (params.cc_load_policy) { delete params.cc_load_policy; } @@ -210,11 +212,23 @@ export default { // https://developers.google.com/youtube/player_parameters#controls var controls = options.getRequestOptions('youtube.controls', params.controls); if (controls == 0) { - params.controls = '0'; + params.controls = 0; } else if (params.controls) { delete params.controls; } + // https://developers.google.com/youtube/player_parameters#loop + var loop = options.getRequestOptions('youtube.loop', params.loop); + if (loop) { + params.loop = 1; + // 'To loop a single video, set the loop parameter value to 1 and set the playlist parameter value to the same video ID' + if (!params.playlist) { + params.playlist = youtube_video_gdata.id; + } + } else if (params.loop) { + delete params.loop; + } + // Support for direct links to YouTube clip embeds if (/\/embed\/[^\?]+\?.*clip=.+clipt=.+/i.test(url)) { var uri = url; @@ -254,7 +268,7 @@ export default { var links = []; var aspect = widescreen ? 16 / 9 : 4 / 3; - if (youtube_video_gdata.embeddable) { + if (youtube_video_gdata.embeddable && youtube_video_gdata.ytRating !== 'ytAgeRestricted') { var qs = querystring.stringify(params); if (qs !== '') {qs = '?' + qs} @@ -284,6 +298,8 @@ export default { } } }); + } else if (youtube_video_gdata.ytRating === 'ytAgeRestricted') { + links.push({message: "This video is age-restricted and only available on YouTube"}); } else { links.push({message: (youtube_video_gdata.uploader || "Uploader of this video") + " disabled embedding on other sites."}); }