This commit is contained in:
Theenoro
2026-02-26 09:34:55 +01:00
parent ff9864a1db
commit a6d8f3c2ee
6 changed files with 435 additions and 0 deletions

19
providers/youtube.py Normal file
View File

@@ -0,0 +1,19 @@
from .base import EmbedProvider
class YouTubeProvider(EmbedProvider):
name = "youtube"
pattern = r"\{\{YOUTUBE:([A-Za-z0-9_-]+)\}\}"
def replace(self, match):
video_id = match.group(1)
nocookie = self.config.get("nocookie", True)
domain = "www.youtube-nocookie.com" if nocookie else "www.youtube.com"
embed_html = f'''
<iframe width="560" height="315"
src="https://{domain}/embed/{video_id}"
frameborder="0"
allowfullscreen>
</iframe>
'''
return self.wrap_template("youtube", embed_html)