embed nitter

This commit is contained in:
j 2022-03-18 14:48:39 +00:00
parent fd0833a8ae
commit 1695a075f3

View file

@ -39,6 +39,8 @@ class Event(models.Model):
url = self.media url = self.media
if 'youtube.com/watch' in url: if 'youtube.com/watch' in url:
url = url.replace('/watch?v=', '/embed/') url = url.replace('/watch?v=', '/embed/')
elif 'twitter.com/' in url:
url = ur.replace('twitter.com', 'nitter.net')
html += '<iframe src="%s" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>' % url html += '<iframe src="%s" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>' % url
if self.media_caption: if self.media_caption:
html = '<figure>%s<figcaption>%s</figcaption></figure>' % (html, self.media_caption) html = '<figure>%s<figcaption>%s</figcaption></figure>' % (html, self.media_caption)