Skip to content

Commit e78afe8

Browse files
committed
Add support for YouTube shorts
1 parent c09385e commit e78afe8

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Change log
1010

1111
- Fixed the ``APPEND_SLASH`` handling to also use ``request.path_info``, not
1212
``request.path``.
13+
- Added support for embedding YouTube shorts when using
14+
:mod:`feincms3.embedding`.
1315

1416

1517
`3.5`_ (2022-04-11)

feincms3/embedding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
YOUTUBE_RE = re.compile(
1414
r"""youtu(\.?)be(\.com)?/ # match youtube's domains
1515
(\#/)? # for mobile urls
16-
(embed/)? # match the embed url syntax
16+
(embed/|shorts/|watch/)? # match the embed/shorts/watch url syntax
1717
(v/)?
1818
(watch\?v=)? # match the youtube page url
1919
(ytscreeningroom\?v=)?

tests/testapp/test_embedding.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ def test_youtube(self):
3434
"https://www.youtube.com/watch?v=DYu_bGbZiiQ&list=RDJMOOG7rWTPg&index=7"
3535
)
3636
)
37+
self.assertTrue(embed("https://www.youtube.com/watch/ZumRshfKdtM"))
38+
self.assertTrue(embed("https://www.youtube.com/shorts/ZumRshfKdtM"))
3739

3840
def test_vimeo(self):
3941
"""Vimeo video embedding works"""

0 commit comments

Comments
 (0)