diff --git a/config.local.js.SAMPLE b/config.local.js.SAMPLE index 72bb99a27..6eea66258 100644 --- a/config.local.js.SAMPLE +++ b/config.local.js.SAMPLE @@ -256,8 +256,7 @@ export default { youtube: { // api_key: "INSERT YOUR VALUE", // parts: [ "snippet", "player" ], // list of fields you want to use in the request, in most cases you only need those two - get_params: "?rel=0&showinfo=1", // https://developers.google.com/youtube/player_parameters, - fix_shorts_in_eu: true // Avoid consent redirect for EU servers + get_params: "?rel=0&showinfo=1", // https://developers.google.com/youtube/player_parameters }, vimeo: { get_params: "?byline=0&badge=0" // https://developer.vimeo.com/player/embedding diff --git a/lib/plugins/system/oembed/oembed.js b/lib/plugins/system/oembed/oembed.js index 94f1dcb36..baf4c7738 100644 --- a/lib/plugins/system/oembed/oembed.js +++ b/lib/plugins/system/oembed/oembed.js @@ -106,7 +106,7 @@ function getOembedIframeAttr(oembed) { export default { - provides: ['self', 'oembedError'], + provides: ['self', 'oembedError', '__oembedError'], getIframe: _getOembedIframe, // available via export for fallbacks as plugins['oembed'].getIframe(obj) @@ -129,14 +129,19 @@ export default { if (error && !oembed) { return cb('Oembed error "'+ oembedLinks[0].href + '": ' + error, { - oembedError: error + oembedError: error, + __oembedError: error // To enable fallbacks to optional meta }); } else if (error && oembed) { // via `options.parseErrorBody = true` return cb(null, { oembedError: { code: error, body: oembed - } + }, + __oembedError: { // To enable fallbacks to optional meta + code: error, + body: oembed + }, }); } diff --git a/plugins/domains/soundcloud.com/soundcloud-oembed-error.js b/plugins/domains/soundcloud.com/soundcloud-oembed-error.js index 1e9e94d62..6af3c7eff 100644 --- a/plugins/domains/soundcloud.com/soundcloud-oembed-error.js +++ b/plugins/domains/soundcloud.com/soundcloud-oembed-error.js @@ -2,7 +2,8 @@ export default { provides: ['__allow_soundcloud_meta', 'iframe'], - getData: function(oembedError, twitter, options, plugins, cb) { + getData: function(__oembedError, twitter, options, plugins, cb) { + var oembedError = __oembedError; var disable_private = options.getProviderOptions('soundcloud.disable_private', false) if (oembedError === 403 && !disable_private && twitter.player) { return cb(null, { diff --git a/plugins/domains/youtube.com/youtube.shorts.js b/plugins/domains/youtube.com/youtube.shorts.js index 41ade1469..6a5854819 100644 --- a/plugins/domains/youtube.com/youtube.shorts.js +++ b/plugins/domains/youtube.com/youtube.shorts.js @@ -1,7 +1,7 @@ /** - * This is an alternative fix for https://github.com/itteco/iframely/issues/543. - * If your servers are in EU, this avoids a redirect to cookie consents, - * Activate it by addong + * This was an alternative fix for https://github.com/itteco/iframely/issues/543. + * YT Shorts are now covered by main plugin to detect age-restricted players that do not work. + * Here, we only need a bigger og-image */ export default { @@ -9,21 +9,11 @@ export default { re: /^https?:\/\/www\.youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/i, mixins: [ - "domain-icon", - "oembed-title", - "oembed-site", - "oembed-author", - "oembed-thumbnail", - "oembed-video", // "allow" attributes will be merged from there - "oembed-iframe" + "og-image", + "oembed-thumbnail" // smaller image is backup for EU where they may get a redirect to consent page ], - getLink: function(iframe) { - return { - href: iframe.src, - type: CONFIG.T.text_html, - rel: CONFIG.R.player, - "aspect-ratio": 9/16, - } + getData: function(options) { + options.followHTTPRedirect = true; } }; \ 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 2c9167dfd..a76042446 100644 --- a/plugins/domains/youtube.com/youtube.video.js +++ b/plugins/domains/youtube.com/youtube.video.js @@ -11,7 +11,8 @@ export default { /^https?:\/\/www\.youtube\.com\/live\/([a-zA-Z0-9_-]+)/i, /^https?:\/\/www\.youtube\.com\/v\/([a-zA-Z0-9_-]+)/i, /^https?:\/\/www\.youtube\.com\/user\/[a-zA-Z0-9_-]+\/?\?v=([a-zA-Z0-9_-]+)/i, - /^https?:\/\/www\.youtube-nocookie\.com\/(?:v|embed)\/([a-zA-Z0-9_-]+)/i + /^https?:\/\/www\.youtube-nocookie\.com\/(?:v|embed)\/([a-zA-Z0-9_-]+)/i, + /^https?:\/\/www\.youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/i ], mixins: ["domain-icon"], @@ -104,7 +105,8 @@ export default { embeddable: entry.status ? entry.status.embeddable : true, uploadStatus: entry.status?.uploadStatus, status: entry.status, - ytRating: entry.contentDetails?.contentRating?.ytRating + ytRating: entry.contentDetails?.contentRating?.ytRating, + isShort: /\/shorts\//i.test(urlMatch[0]) }; if (entry.snippet?.thumbnails) { @@ -266,7 +268,7 @@ export default { // End of widescreen & allow check var links = []; - var aspect = widescreen ? 16 / 9 : 4 / 3; + var aspect = youtube_video_gdata.isShort ? 9 / 16 : (widescreen ? 16 / 9 : 4 / 3); if (youtube_video_gdata.embeddable && youtube_video_gdata.ytRating !== 'ytAgeRestricted') {