Skip to content

Commit

Permalink
Merge pull request #114 from molgen/youtube-noocookie
Browse files Browse the repository at this point in the history
embed: Use youtube-nocookie.com
  • Loading branch information
donald authored Mar 25, 2021
2 parents 73e2c78 + 58ed790 commit 73c51f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,5 @@
WAGTAILAPI_LIMIT_MAX = 50

DATA_UPLOAD_MAX_NUMBER_FIELDS=None

WAGTAILEMBEDS_FINDERS = [ { 'class': 'mpicms.base.oembed' } ]
9 changes: 9 additions & 0 deletions mpicms/base/oembed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import wagtail.embeds.finders.oembed

class OEmbedFinder(wagtail.embeds.finders.oembed.embed_finder_class):
def find_embed(self, url, max_width=None):
d = super().find_embed(url, max_width);
d['html'] = d['html'].replace('https://www.youtube.com/embed/', 'https://www.youtube-nocookie.com/embed/', 1)
return d

embed_finder_class = OEmbedFinder

0 comments on commit 73c51f8

Please sign in to comment.