Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
nleush committed Nov 5, 2024
2 parents 2353929 + 4d63698 commit febe516
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 26 deletions.
3 changes: 1 addition & 2 deletions config.local.js.SAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions lib/plugins/system/oembed/oembed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
},
});
}

Expand Down
3 changes: 2 additions & 1 deletion plugins/domains/soundcloud.com/soundcloud-oembed-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down
24 changes: 7 additions & 17 deletions plugins/domains/youtube.com/youtube.shorts.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
/**
* 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 {

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;
}
};
8 changes: 5 additions & 3 deletions plugins/domains/youtube.com/youtube.video.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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') {

Expand Down

0 comments on commit febe516

Please sign in to comment.