Skip to content

Commit 85d45dc

Browse files
committed
MediaEmbed: updated YouTube
Some YouTube videos require a referrer to be set
1 parent e151a21 commit 85d45dc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Plugins/MediaEmbed/Configurator/Collections/CachedDefinitionCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,6 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
146146
'xenforo'=>['attributes'=>['content_id'=>['filterChain'=>['#identifier'],'required'=>false],'post_id'=>['filterChain'=>['#uint'],'required'=>false],'profile_post_id'=>['filterChain'=>['#uint'],'required'=>false],'resource_id'=>['filterChain'=>['#uint'],'required'=>false],'thread_id'=>['filterChain'=>['#uint'],'required'=>false],'url'=>['filterChain'=>['#url'],'required'=>true],'xfmg_album_id'=>['filterChain'=>['#uint'],'required'=>false]],'example'=>'https://xenforo.com/community/threads/embed-your-content-anywhere.217381/','extract'=>['!^(?\'url\'https://.*?/)media/albums/(?:[-\\w]+\\.)?(?\'xfmg_album_id\'\\d+)!','!^(?\'url\'https://.*?/)(?:members/[-.\\w]+/#profile-post-|profile-posts/)(?\'profile_post_id\'\\d+)!','!^(?\'url\'https://.*?/)resources/(?:[-\\w]+\\.)?(?\'resource_id\'\\d+)!','!^(?\'url\'https://.*?/)threads/(?:[-\\w]+\\.)?(?\'thread_id\'\\d+)/(?:page-\\d+)?#?(?:post-(?\'post_id\'\\d+))?!','!^(?\'url\'https://.*?/)embed\\.php\\?content=(?\'content_id\'[-\\w]+)!'],'helper'=>'s9e\\TextFormatter\\Plugins\\MediaEmbed\\Configurator\\SiteHelpers\\XenForoHelper','host'=>[],'iframe'=>['data-s9e-livepreview-ignore-attrs'=>'style','height'=>300,'onload'=>'let c=new MessageChannel;c.port1.onmessage=e=>this.style.height=e.data+\'px\';this.contentWindow.postMessage(\'s9e:init\',\'*\',[c.port2])','src'=>'https://s9e.github.io/iframe/2/xenforo.min.html#<xsl:value-of select="@url"/><xsl:choose><xsl:when test="@profile_post_id">profile-posts/<xsl:value-of select="@profile_post_id"/></xsl:when><xsl:when test="@resource_id">resources/<xsl:value-of select="@resource_id"/></xsl:when><xsl:when test="@xfmg_album_id">media/albums/<xsl:value-of select="@xfmg_album_id"/></xsl:when><xsl:otherwise>threads/<xsl:value-of select="@thread_id"/><xsl:if test="@post_id">/post-<xsl:value-of select="@post_id"/></xsl:if></xsl:otherwise></xsl:choose>','width'=>'100%'],'name'=>'XenForo','scrape'=>[],'tags'=>['social']],
147147
'youku'=>['attributes'=>[],'example'=>'https://v.youku.com/v_show/id_XMzY0NTMyMTgxMg==.html','extract'=>['!youku\\.com/v(?:_show|ideo)/id_(?\'id\'\\w+=*)!'],'homepage'=>'https://www.youku.com/','host'=>['youku.com'],'iframe'=>['src'=>'//player.youku.com/embed/{@id}'],'name'=>'Youku','scrape'=>[],'tags'=>['.cn']],
148148
'youmaker'=>['attributes'=>[],'example'=>['https://www.youmaker.com/v/EnDXOWo8OOvQ','https://www.youmaker.com/video/b3ce8457-2cbe-4661-84ec-829fa8fe0754'],'extract'=>['!youmaker\\.com/(?:embed|v(?:ideo)?)/(?\'id\'[-a-z0-9]+)!i'],'homepage'=>'https://www.youmaker.com/','host'=>['youmaker.com'],'iframe'=>['src'=>'https://www.youmaker.com/embed/{@id}'],'name'=>'YouMaker','scrape'=>[],'tags'=>['videos']],
149-
'youtube'=>['amp'=>['custom-element'=>'amp-youtube','src'=>'https://cdn.ampproject.org/v0/amp-youtube-0.1.js','template'=>'<amp-youtube layout="responsive" width="640" height="360" data-param-list="{@list}" data-param-start="{@t}" data-videoid="{@id}"/>'],'attributes'=>['id'=>['filterChain'=>['#identifier'],'required'=>false],'t'=>['filterChain'=>['#timestamp']]],'example'=>['https://www.youtube.com/watch?v=-cEzsCAzTak','https://youtu.be/-cEzsCAzTak','https://www.youtube.com/watch?feature=player_detailpage&v=jofNR_WkoCE#t=40','https://www.youtube.com/watch?v=pC35x6iIPmo&list=PLOU2XLYxmsIIxJrlMIY5vYXAFcO5g83gA'],'extract'=>['!youtube\\.com/(?:watch.*?v=|(?:embed|live|shorts|v)/|attribution_link.*?v%3D)(?\'id\'[-\\w]+)!','!youtube-nocookie\\.com/embed/(?\'id\'[-\\w]+)!','!youtu\\.be/(?\'id\'[-\\w]+)!','@[#&?]t(?:ime_continue)?=(?\'t\'\\d[\\dhms]*)@','![&?]list=(?\'list\'[-\\w]+)!'],'homepage'=>'https://www.youtube.com/','host'=>['youtube-nocookie.com','youtube.com','youtu.be'],'iframe'=>['src'=>'https://www.youtube.com/embed/<xsl:value-of select="@id"/><xsl:choose><xsl:when test="@clip">?clip=<xsl:value-of select="@clip"/>&amp;clipt=<xsl:value-of select="@clipt"/></xsl:when><xsl:otherwise><xsl:if test="@list">?list=<xsl:value-of select="@list"/></xsl:if><xsl:if test="@t"><xsl:choose><xsl:when test="@list">&amp;</xsl:when><xsl:otherwise>?</xsl:otherwise></xsl:choose>start=<xsl:value-of select="@t"/></xsl:if></xsl:otherwise></xsl:choose>','style'=>['background'=>'url(https://i.ytimg.com/vi/{@id}/hqdefault.jpg) 50% 50% / cover']],'name'=>'YouTube','oembed'=>['endpoint'=>'https://www.youtube.com/oembed','scheme'=>'https://www.youtube.com/watch?v={@id}'],'scrape'=>[['extract'=>['@/embed/(?\'id\'[-\\w]+)\\?clip=(?\'clip\'[-\\w]+)&amp;clipt=(?\'clipt\'[-\\w]+)@'],'match'=>['@youtube\\.com/clip/.@']]],'source'=>'https://support.google.com/youtube/bin/answer.py?hl=en&answer=171780','tags'=>['livestreaming','videos']]
149+
'youtube'=>['amp'=>['custom-element'=>'amp-youtube','src'=>'https://cdn.ampproject.org/v0/amp-youtube-0.1.js','template'=>'<amp-youtube layout="responsive" width="640" height="360" data-param-list="{@list}" data-param-start="{@t}" data-videoid="{@id}"/>'],'attributes'=>['id'=>['filterChain'=>['#identifier'],'required'=>false],'t'=>['filterChain'=>['#timestamp']]],'example'=>['https://www.youtube.com/watch?v=-cEzsCAzTak','https://youtu.be/-cEzsCAzTak','https://www.youtube.com/watch?feature=player_detailpage&v=jofNR_WkoCE#t=40','https://www.youtube.com/watch?v=pC35x6iIPmo&list=PLOU2XLYxmsIIxJrlMIY5vYXAFcO5g83gA'],'extract'=>['!youtube\\.com/(?:watch.*?v=|(?:embed|live|shorts|v)/|attribution_link.*?v%3D)(?\'id\'[-\\w]+)!','!youtube-nocookie\\.com/embed/(?\'id\'[-\\w]+)!','!youtu\\.be/(?\'id\'[-\\w]+)!','@[#&?]t(?:ime_continue)?=(?\'t\'\\d[\\dhms]*)@','![&?]list=(?\'list\'[-\\w]+)!'],'homepage'=>'https://www.youtube.com/','host'=>['youtube-nocookie.com','youtube.com','youtu.be'],'iframe'=>['referrerpolicy'=>'origin','src'=>'https://www.youtube.com/embed/<xsl:value-of select="@id"/><xsl:choose><xsl:when test="@clip">?clip=<xsl:value-of select="@clip"/>&amp;clipt=<xsl:value-of select="@clipt"/></xsl:when><xsl:otherwise><xsl:if test="@list">?list=<xsl:value-of select="@list"/></xsl:if><xsl:if test="@t"><xsl:choose><xsl:when test="@list">&amp;</xsl:when><xsl:otherwise>?</xsl:otherwise></xsl:choose>start=<xsl:value-of select="@t"/></xsl:if></xsl:otherwise></xsl:choose>','style'=>['background'=>'url(https://i.ytimg.com/vi/{@id}/hqdefault.jpg) 50% 50% / cover']],'name'=>'YouTube','oembed'=>['endpoint'=>'https://www.youtube.com/oembed','scheme'=>'https://www.youtube.com/watch?v={@id}'],'scrape'=>[['extract'=>['@/embed/(?\'id\'[-\\w]+)\\?clip=(?\'clip\'[-\\w]+)&amp;clipt=(?\'clipt\'[-\\w]+)@'],'match'=>['@youtube\\.com/clip/.@']]],'source'=>'https://support.google.com/youtube/bin/answer.py?hl=en&answer=171780','tags'=>['livestreaming','videos']]
150150
];
151151
}

src/Plugins/MediaEmbed/Configurator/sites/youtube.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<match>@youtube\.com/clip/.@</match>
2828
<extract>@/embed/(?'id'[-\w]+)\?clip=(?'clip'[-\w]+)&amp;amp;clipt=(?'clipt'[-\w]+)@</extract>
2929
</scrape>
30-
<iframe>
30+
<iframe referrerpolicy="origin">
3131
<src><![CDATA[
3232
<xsl:text>https://www.youtube.com/embed/</xsl:text>
3333
<xsl:value-of select="@id"/>

0 commit comments

Comments
 (0)