Skip to content

Commit 07acd44

Browse files
authored
Fix YouTube error 153 (#217)
* Fix YouTube error 153 I got YouTube error 153 on my embedded players that went away after I added `referrerpolicy="strict-origin-when-cross-origin"` to the template of embed video. This was suggested in few StackOverflow questions and it is based on https://developers.google.com/youtube/terms/required-minimum-functionality#embedded-player-api-client-identity * Ensure that asserts include the referrerpolicy
1 parent b9e6997 commit 07acd44

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<iframe width="{{ width }}" height="{{ height }}" src="{{ backend.url }}" loading="lazy" frameborder="0" allowfullscreen></iframe>
1+
<iframe width="{{ width }}" height="{{ height }}" src="{{ backend.url }}" loading="lazy" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>

embed_video/tests/templatetags/tests_embed_video_tags.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def test_embed(self):
6161
template,
6262
'<iframe width="960" height="720" '
6363
'src="https://www.youtube.com/embed/jsrRJyHBvzw?wmode=opaque" '
64-
'loading="lazy" frameborder="0" allowfullscreen></iframe>',
64+
'loading="lazy" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>',
6565
)
6666

6767
def test_embed_invalid_url(self):
@@ -97,7 +97,7 @@ def test_direct_embed_tag(self):
9797
template,
9898
'<iframe width="960" height="720" '
9999
'src="https://www.youtube.com/embed/jsrRJyHBvzw?wmode=opaque" '
100-
'loading="lazy" frameborder="0" allowfullscreen></iframe>',
100+
'loading="lazy" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>',
101101
)
102102

103103
def test_direct_embed_tag_with_default_size(self):
@@ -109,7 +109,7 @@ def test_direct_embed_tag_with_default_size(self):
109109
template,
110110
'<iframe width="480" height="360" '
111111
'src="https://www.youtube.com/embed/jsrRJyHBvzw?wmode=opaque" '
112-
'loading="lazy" frameborder="0" allowfullscreen></iframe>',
112+
'loading="lazy" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>',
113113
)
114114

115115
def test_direct_embed_invalid_url(self):
@@ -130,7 +130,7 @@ def test_user_size(self):
130130
template,
131131
'<iframe width="800" height="800" '
132132
'src="https://www.youtube.com/embed/jsrRJyHBvzw?wmode=opaque" '
133-
'loading="lazy" frameborder="0" allowfullscreen></iframe>',
133+
'loading="lazy" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>',
134134
)
135135

136136
def test_wrong_size(self):
@@ -233,7 +233,7 @@ def test_relative_size(self):
233233
template,
234234
'<iframe width="80%" height="30%" '
235235
'src="https://player.vimeo.com/video/72304002" '
236-
'loading="lazy" frameborder="0" allowfullscreen></iframe>',
236+
'loading="lazy" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>',
237237
)
238238

239239
def test_allow_spaces_in_size(self):
@@ -245,7 +245,7 @@ def test_allow_spaces_in_size(self):
245245
template,
246246
'<iframe width="80%" height="300" '
247247
'src="https://player.vimeo.com/video/72304002" '
248-
'loading="lazy" frameborder="0" allowfullscreen></iframe>',
248+
'loading="lazy" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>',
249249
)
250250

251251
def test_embed_with_query(self):
@@ -285,7 +285,7 @@ def test_direct_embed_with_query(self):
285285
output_without_url,
286286
'<iframe width="480" height="360" '
287287
'src="URL" '
288-
'loading="lazy" frameborder="0" allowfullscreen></iframe>',
288+
'loading="lazy" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>',
289289
)
290290

291291
def test_set_options(self):
@@ -297,7 +297,7 @@ def test_set_options(self):
297297
template,
298298
'<iframe width="300" height="200" '
299299
'src="https://www.youtube.com/embed/jsrRJyHBvzw?rel=1" '
300-
'loading="lazy" frameborder="0" allowfullscreen></iframe>',
300+
'loading="lazy" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>',
301301
)
302302

303303
def test_size_as_variable(self):
@@ -311,7 +311,7 @@ def test_size_as_variable(self):
311311
template,
312312
'<iframe width="500" height="200" '
313313
'src="https://www.youtube.com/embed/jsrRJyHBvzw?wmode=opaque" '
314-
'loading="lazy" frameborder="0" allowfullscreen></iframe>',
314+
'loading="lazy" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>',
315315
)
316316

317317

0 commit comments

Comments
 (0)