-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
youtube: an option to fix EU redirects for YT shorts via a feature flag
Please configure `fix_shorts_in_eu: true` - see example config file. cc #543
- Loading branch information
1 parent
d13e3a0
commit 17c8cdb
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* 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 | ||
*/ | ||
|
||
export default { | ||
|
||
re: /^https?:\/\/www\.youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/i, | ||
|
||
// The issue with EU consent redirect needs to be bypassed | ||
// by avoiding htmlparser-dependent plugins and mixins. | ||
|
||
notPlugin: !CONFIG.providerOptions?.youtube?.fix_shorts_in_eu, | ||
|
||
mixins: [ | ||
"domain-icon", | ||
"oembed-title", | ||
"oembed-site", | ||
"oembed-author", | ||
"oembed-thumbnail", | ||
"oembed-video", // "allow" attributes will be merged from there | ||
"oembed-iframe" | ||
], | ||
|
||
getLink: function(iframe) { | ||
return { | ||
href: iframe.src, | ||
type: CONFIG.T.text_html, | ||
rel: CONFIG.R.player, | ||
"aspect-ratio": 9/16, | ||
} | ||
} | ||
}; |