Skip to content

Instantly share code, notes, and snippets.

@iparamonau
Created April 6, 2021 14:29
Show Gist options
  • Save iparamonau/3ed562a0de4517ab641da8ca728bafcf to your computer and use it in GitHub Desktop.
Save iparamonau/3ed562a0de4517ab641da8ca728bafcf to your computer and use it in GitHub Desktop.
Iframely YouTube fix for EU-constent redirects
/**
* This is an alternative fix for https://github.com/itteco/iframely/issues/326.
* If your servers are in EU and you do not wish to use YouTube API,
* add this file to your private plugins directory (`/domains/` subfolder).
* See `CUSTOM_PLUGINS_PATH` in config.local.js.SAMPLE.
* This will override the youtube.video.js plugin from the main package.
*/
module.exports = {
re: [
/^https?:\/\/(?:www\.)?youtube\.com\/watch\/?\?(?:[^&]+&)*v=([a-zA-Z0-9_-]+)/i,
/^https?:\/\/youtu.be\/([a-zA-Z0-9_-]+)/i,
/^https?:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]+)/i
],
// The issue with EU consent redirect needs to be bypassed
// by avoiding htmlparser-dependent plugins and mixins.
mixins: [
"domain-icon",
"oembed-title",
"oembed-site",
"oembed-author",
"oembed-thumbnail",
"oembed-video"
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment