Skip to content

Commit

Permalink
WiP
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Mar 8, 2021
1 parent 7a3044c commit e94a2c7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
'pinterest'=>['amp'=>['custom-element'=>'amp-pinterest','src'=>'https://cdn.ampproject.org/v0/amp-pinterest-0.1.js','template'=>'<amp-pinterest width="245" height="330" data-do="embedPin" data-url="https://www.pinterest.com/pin/{@id}/"/>'],'attributes'=>[],'example'=>['https://www.pinterest.com/pin/99360735500167749/','https://www.pinterest.com/pinterest/official-news/'],'extract'=>['@pinterest.com/pin/(?\'id\'\\d+)@','@pinterest.com/(?!_/|discover/|explore/|news_hub/|pin/|search/)(?\'id\'[-\\w]+/[-\\w]+)@'],'homepage'=>'https://www.pinterest.com/','host'=>['pinterest.com'],'iframe'=>['data-s9e-livepreview-ignore-attrs'=>'style','height'=>360,'onload'=>'var c=new MessageChannel;c.port1.onmessage=function(e){{style.height=e.data+\'px\'}};contentWindow.postMessage(\'s9e:init\',\'https://s9e.github.io\',[c.port2])','src'=>'https://s9e.github.io/iframe/2/pinterest.min.html#{@id}','width'=>'<xsl:choose><xsl:when test="contains(@id,\'/\')">730</xsl:when><xsl:otherwise>345</xsl:otherwise></xsl:choose>'],'name'=>'Pinterest','scrape'=>[],'source'=>'https://developers.pinterest.com/tools/widget-builder/','tags'=>['social']],
'podbean'=>['attributes'=>[],'example'=>['https://dialhforheroclix.podbean.com/e/dial-h-for-heroclix-episode-46-all-ya-need-is-love/','https://www.podbean.com/media/share/pb-qtwub-4ee10c'],'extract'=>['!podbean\\.com/media/(?:player/|share/pb-)(?\'id\'[-\\w]+)!'],'homepage'=>'https://www.podbean.com/','host'=>['podbean.com'],'iframe'=>['height'=>100,'max-width'=>900,'src'=>'//www.podbean.com/media/player/{@id}','width'=>'100%'],'name'=>'Podbean','scrape'=>[['extract'=>['!podbean\\.com/media/player/(?\'id\'[-\\w]+)!'],'match'=>['@podbean\\.com/(?:media/shar)?e/(?!pb-)@']]],'tags'=>['podcasts']],
'prezi'=>['attributes'=>[],'example'=>'https://prezi.com/5ye8po_hmikp/10-most-common-rookie-presentation-mistakes/','extract'=>['#//prezi\\.com/(?!(?:a(?:bout|mbassadors)|c(?:o(?:llaborate|mmunity|ntact)|reate)|exp(?:erts|lore)|ip(?:ad|hone)|jobs|l(?:ear|ogi)n|m(?:ac|obility)|pr(?:es(?:s|ent)|icing)|recommend|support|user|windows|your)/)(?\'id\'\\w+)/#'],'homepage'=>'https://prezi.com/','host'=>['prezi.com'],'iframe'=>['height'=>400,'src'=>'//prezi.com/embed/{@id}/','width'=>550],'name'=>'Prezi','scrape'=>[],'tags'=>['presentations']],
'reddit'=>['attributes'=>[],'example'=>['https://www.reddit.com/r/pics/comments/9wp1qg/my_mom_recently_started_watercolor_painting_and/','https://www.reddit.com/r/pics/comments/9wp1qg/my_mom_recently_started_watercolor_painting_and/e9m6pn9/'],'extract'=>['!(?\'id\'\\w+/comments/\\w+(?:/\\w+/\\w+)?)!'],'homepage'=>'https://www.reddit.com/','host'=>['reddit.com'],'iframe'=>['data-s9e-livepreview-ignore-attrs'=>'style','height'=>165,'onload'=>'var c=new MessageChannel;c.port1.onmessage=function(e){{style.height=e.data+\'px\'}};contentWindow.postMessage(\'s9e:init\',\'https://s9e.github.io\',[c.port2])','src'=>'https://s9e.github.io/iframe/2/reddit.min.html#{@id}{@path}','width'=>800],'name'=>'Reddit threads and comments','scrape'=>[],'source'=>'https://www.reddit.com/wiki/embeds','tags'=>['social']],
'reddit'=>['amp'=>['custom-element'=>'amp-reddit','src'=>'https://cdn.ampproject.org/v0/amp-reddit-0.1.js','template'=>'<amp-reddit layout="responsive" width="450" height="300" data-embedtype="post" data-src="https://www.reddit.com/r/{@id}/"/>'],'attributes'=>[],'example'=>['https://www.reddit.com/r/pics/comments/9wp1qg/my_mom_recently_started_watercolor_painting_and/','https://www.reddit.com/r/pics/comments/9wp1qg/my_mom_recently_started_watercolor_painting_and/e9m6pn9/'],'extract'=>['!(?\'id\'\\w+/comments/\\w+(?:/\\w+/\\w+)?)!'],'homepage'=>'https://www.reddit.com/','host'=>['reddit.com'],'iframe'=>['data-s9e-livepreview-ignore-attrs'=>'style','height'=>165,'onload'=>'var c=new MessageChannel;c.port1.onmessage=function(e){{style.height=e.data+\'px\'}};contentWindow.postMessage(\'s9e:init\',\'https://s9e.github.io\',[c.port2])','src'=>'https://s9e.github.io/iframe/2/reddit.min.html#{@id}{@path}','width'=>800],'name'=>'Reddit threads and comments','scrape'=>[],'source'=>'https://www.reddit.com/wiki/embeds','tags'=>['social']],
'rumble'=>['attributes'=>[],'example'=>'https://rumble.com/vaxo02-i-cant-climb-.html','extract'=>['!rumble\\.com/embed/(?\'id\'\\w+)!'],'homepage'=>'https://rumble.com/','host'=>['rumble.com'],'iframe'=>['src'=>'https://rumble.com/embed/{@id}/'],'name'=>'Rumble','scrape'=>[['extract'=>['!video"?:"(?\'id\'\\w+)!'],'match'=>['#rumble\\.com/(?!embed/).#']]],'tags'=>['videos']],
'rutube'=>['attributes'=>[],'example'=>['https://rutube.ru/play/embed/4782775','https://rutube.ru/tracks/4118278.html?v=8b490a46447720d4ad74616f5de2affd'],'extract'=>['!rutube\\.ru/(?:play/embed|tracks)/(?\'id\'\\d+)!'],'homepage'=>'https://rutube.ru/','host'=>['rutube.ru'],'iframe'=>['height'=>405,'src'=>'//rutube.ru/play/embed/{@id}','width'=>720],'name'=>'Rutube','scrape'=>[['extract'=>['!rutube\\.ru/play/embed/(?\'id\'\\d+)!'],'header'=>'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.0.0 Safari/537.36','match'=>['!rutube\\.ru/video/(?\'vid\'[0-9a-f]{32})!'],'url'=>'https://rutube.ru/api/oembed/?url=https://rutube.ru/video/{@vid}/']],'tags'=>['.ru']],
'scribd'=>['attributes'=>[],'example'=>['https://www.scribd.com/doc/237147661/Calculus-2-Test-1-Review','https://www.scribd.com/presentation/324333881/600-1450-World-History-Jeopardy'],'extract'=>['!scribd\\.com/(?:mobile/)?(?:doc(?:ument)?|presentation)/(?\'id\'\\d+)!'],'homepage'=>'https://www.scribd.com/','host'=>['scribd.com'],'iframe'=>['height'=>500,'src'=>'https://www.scribd.com/embeds/{@id}/content?view_mode=scroll&show_recommendations=false','style'=>['resize'=>'vertical'],'width'=>'100%'],'name'=>'Scribd','scrape'=>[],'tags'=>['documents','presentations']],
Expand Down Expand Up @@ -148,7 +148,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
'veoh'=>['attributes'=>[],'example'=>'https://www.veoh.com/watch/v6335577TeB8kyNR','extract'=>['!veoh\\.com/(?:m/watch\\.php\\?v=|watch/)v(?\'id\'\\w+)!'],'flash'=>['padding-height'=>40,'src'=>'//www.veoh.com/swf/webplayer/WebPlayer.swf?version=AFrontend.5.7.0.1509&permalinkId=v{@id}&player=videodetailsembedded&videoAutoPlay=0&id=anonymous'],'homepage'=>'https://www.veoh.com/','host'=>['veoh.com'],'name'=>'Veoh','scrape'=>[],'tags'=>['videos']],
'vevo'=>['attributes'=>[],'example'=>['https://www.vevo.com/watch/USUV71400682','https://www.vevo.com/watch/eminem/the-monster-explicit/USUV71302925'],'extract'=>['!vevo\\.com/watch/(.*?/)?(?\'id\'[A-Z]+\\d+)!'],'homepage'=>'https://vevo.com/','host'=>['vevo.com'],'iframe'=>['src'=>'https://embed.vevo.com/?isrc={@id}'],'name'=>'Vevo','scrape'=>[],'tags'=>['music']],
'videodetective'=>['attributes'=>[],'example'=>'https://www.videodetective.com/movies/zootopia/658596','extract'=>['!videodetective\\.com/\\w+/[-\\w]+/(?:trailer/P0*)?(?\'id\'\\d+)!'],'homepage'=>'https://www.videodetective.com/','host'=>['videodetective.com'],'iframe'=>['src'=>'//www.videodetective.com/embed/video/?options=false&autostart=false&playlist=none&publishedid={@id}'],'name'=>'Video Detective','scrape'=>[]],
'vimeo'=>['attributes'=>['t'=>['filterChain'=>['#timestamp']]],'example'=>['https://vimeo.com/67207222','https://vimeo.com/channels/staffpicks/67207222'],'extract'=>['!vimeo\\.com/(?:channels/[^/]+/|video/)?(?\'id\'\\d+)!','!#t=(?\'t\'[\\dhms]+)!'],'homepage'=>'https://vimeo.com/','host'=>['vimeo.com'],'iframe'=>['src'=>'//player.vimeo.com/video/<xsl:value-of select="@id"/><xsl:if test="@t">#t=<xsl:value-of select="@t"/></xsl:if>'],'name'=>'Vimeo','oembed'=>['endpoint'=>'https://vimeo.com/api/oembed.json','scheme'=>'https://vimeo.com/{@id}'],'scrape'=>[],'source'=>'http://developer.vimeo.com/player/embedding','tags'=>['videos']],
'vimeo'=>['amp'=>['custom-element'=>'amp-vimeo','src'=>'https://cdn.ampproject.org/v0/amp-vimeo-0.1.js','template'=>'<amp-vimeo layout="responsive" width="640" height="360" data-videoid="{@id}"/>'],'attributes'=>['t'=>['filterChain'=>['#timestamp']]],'example'=>['https://vimeo.com/67207222','https://vimeo.com/channels/staffpicks/67207222'],'extract'=>['!vimeo\\.com/(?:channels/[^/]+/|video/)?(?\'id\'\\d+)!','!#t=(?\'t\'[\\dhms]+)!'],'homepage'=>'https://vimeo.com/','host'=>['vimeo.com'],'iframe'=>['src'=>'//player.vimeo.com/video/<xsl:value-of select="@id"/><xsl:if test="@t">#t=<xsl:value-of select="@t"/></xsl:if>'],'name'=>'Vimeo','oembed'=>['endpoint'=>'https://vimeo.com/api/oembed.json','scheme'=>'https://vimeo.com/{@id}'],'scrape'=>[],'source'=>'http://developer.vimeo.com/player/embedding','tags'=>['videos']],
'vine'=>['attributes'=>[],'example'=>'https://vine.co/v/bYwPIluIipH','extract'=>['!vine\\.co/v/(?\'id\'[^/]+)!'],'homepage'=>'https://vine.co/','host'=>['vine.co'],'iframe'=>['height'=>480,'src'=>'https://vine.co/v/{@id}/embed/simple?audio=1','width'=>480],'name'=>'Vine','scrape'=>[],'tags'=>['social','videos']],
'vk'=>['attributes'=>[],'example'=>['https://vk.com/video121599878_165723901?hash=e06b0878046e1d32','https://vk.com/video_ext.php?oid=121599878&id=165723901&hash=e06b0878046e1d32'],'extract'=>['!vk(?:\\.com|ontakte\\.ru)/(?:[\\w.]+\\?z=)?video(?\'oid\'-?\\d+)_(?\'vid\'\\d+).*?hash=(?\'hash\'[0-9a-f]+)!','!vk(?:\\.com|ontakte\\.ru)/video_ext\\.php\\?oid=(?\'oid\'-?\\d+)&id=(?\'vid\'\\d+)&hash=(?\'hash\'[0-9a-f]+)!'],'homepage'=>'https://vk.com/','host'=>['vk.com','vkontakte.ru'],'iframe'=>['src'=>'//vk.com/video_ext.php?oid={@oid}&id={@vid}&hash={@hash}&hd=1'],'name'=>'VK','scrape'=>[['extract'=>['#meta property="og:video" content=".*?oid=(?\'oid\'-?\\d+).*?id=(?\'vid\'\\d+).*?hash=(?\'hash\'[0-9a-f]+)#'],'header'=>'User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0','match'=>['#^(?!.*?hash=)#']]],'tags'=>['.ru']],
'vocaroo'=>['attributes'=>[],'choose'=>['otherwise'=>['iframe'=>['height'=>60,'src'=>'https://vocaroo.com/embed/{@id}','width'=>300]],'when'=>['flash'=>['height'=>44,'src'=>'//vocaroo.com/player.swf?playMediaID={@id}&autoplay=0','width'=>148],'test'=>'starts-with(@id, \'s0\') or starts-with(@id, \'s1\')']],'example'=>'https://vocaroo.com/3OlvdB6eiiK','extract'=>['!voca(?:\\.ro|roo\\.com)/(?:i/)?(?\'id\'\\w+)!'],'homepage'=>'https://vocaroo.com/','host'=>['voca.ro','vocaroo.com'],'name'=>'Vocaroo','scrape'=>[]],
Expand Down
10 changes: 10 additions & 0 deletions src/Plugins/MediaEmbed/Configurator/sites/reddit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,14 @@
<host>reddit.com</host>
<extract>!(?'id'\w+/comments/\w+(?:/\w+/\w+)?)!</extract>
<iframe width="800" height="165" src="https://s9e.github.io/iframe/2/reddit.min.html#{@id}{@path}" onload="var c=new MessageChannel;c.port1.onmessage=function(e){{style.height=e.data+'px'}};contentWindow.postMessage('s9e:init','https://s9e.github.io',[c.port2])" data-s9e-livepreview-ignore-attrs="style"/>

<amp custom-element="amp-reddit" src="https://cdn.ampproject.org/v0/amp-reddit-0.1.js">
<template><![CDATA[
<amp-reddit layout="responsive" width="450" height="300"
data-embedtype="post"
data-src="https://www.reddit.com/r/{@id}/"
>
</amp-reddit>
]]></template>
</amp>
</site>
8 changes: 8 additions & 0 deletions src/Plugins/MediaEmbed/Configurator/sites/vimeo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@
<xsl:if test="@t">#t=<xsl:value-of select="@t"/></xsl:if>
]]></src>
</iframe>

<amp custom-element="amp-vimeo" src="https://cdn.ampproject.org/v0/amp-vimeo-0.1.js">
<template><![CDATA[
<amp-vimeo layout="responsive" width="640" height="360"
data-videoid="{@id}"
></amp-vimeo>
]]></template>
</amp>
</site>
10 changes: 10 additions & 0 deletions tests/Plugins/MediaEmbed/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5522,6 +5522,11 @@ function ($configurator)
'https://www.pinterest.com/pin/99360735500167749/',
'<amp-pinterest width="245" height="330" data-do="embedPin" data-url="https://www.pinterest.com/pin/99360735500167749/"></amp-pinterest>'
],
[
'reddit',
'https://www.reddit.com/r/pics/comments/9wp1qg/my_mom_recently_started_watercolor_painting_and/',
'<amp-reddit layout="responsive" width="450" height="300" data-embedtype="post" data-src="https://www.reddit.com/r/pics/comments/9wp1qg/"></amp-reddit>'
],
[
'soundcloud',
'https://api.soundcloud.com/tracks/98282116',
Expand All @@ -5537,6 +5542,11 @@ function ($configurator)
'https://twitter.com/IJasonAlexander/statuses/526635414338023424',
'<amp-twitter layout="responsive" width="550" height="250" data-tweetid="526635414338023424"><blockquote placeholder=""><a href="https://twitter.com/user/status/526635414338023424">Twitter</a></blockquote></amp-twitter>'
],
[
'vimeo',
'https://vimeo.com/67207222',
'<amp-vimeo layout="responsive" width="640" height="360" data-videoid="67207222"></amp-vimeo>'
],
[
'youtube',
'http://www.youtube.com/watch?v=wZZ7oFKsKzY',
Expand Down

0 comments on commit e94a2c7

Please sign in to comment.