Skip to content

Commit

Permalink
MediaEmbed: added On3 DB
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Apr 3, 2024
1 parent 8d91c8b commit 487e3c4
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 43 deletions.
4 changes: 4 additions & 0 deletions docs/Plugins/MediaEmbed/Sites.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@
<td><code>odysee</code></td>
<td>https://odysee.com/@veritasium:f/the-secret-of-synchronization:2</td>
</tr>
<tr title="On3 DB" id="on3">
<td><code>on3</code></td>
<td>https://www.on3.com/db/christian-jones-150372/industry-comparison/</td>
</tr>
<tr title="Orfium" id="orfium">
<td><code>orfium</code></td>
<td>https://www.orfium.com/album/24371/everybody-loves-kanye-totom/<br/>https://www.orfium.com/live-set/614763/foof-no-lights-5-foof/<br/>https://www.orfium.com/playlist/511651/electronic-live-sessions-creamtronic/<br/>https://www.orfium.com/track/625367/the-ambience-of-the-goss-vistas/</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/Plugins/MediaEmbed/Using_default_sites.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ echo count($configurator->MediaEmbed->defaultSites), " sites remaining.\n";
```
Does YouTube exist? yes
What about now? no
131 sites remaining.
132 sites remaining.
0 sites remaining.
```

Expand Down
4 changes: 4 additions & 0 deletions docs/testdox.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7253,6 +7253,8 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing tests with data set #334
[x] Parsing tests with data set #335
[x] Parsing tests with data set #336
[x] Parsing tests with data set #337
[x] Parsing tests with data set #338
[x] Parsing tests (JavaScript) with data set #0
[x] Parsing tests (JavaScript) with data set #1
[x] Parsing tests (JavaScript) with data set #2
Expand Down Expand Up @@ -7590,6 +7592,8 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing tests (JavaScript) with data set #334
[x] Parsing tests (JavaScript) with data set #335
[x] Parsing tests (JavaScript) with data set #336
[x] Parsing tests (JavaScript) with data set #337
[x] Parsing tests (JavaScript) with data set #338
[x] Parsing+rendering tests with data set #0
[x] Parsing+rendering tests with data set #1
[x] Parsing+rendering tests with data set #2
Expand Down
78 changes: 39 additions & 39 deletions src/Bundles/MediaPack.php

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/Bundles/MediaPack/Renderer.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
'npr'=>['attributes'=>[],'example'=>['https://www.npr.org/blogs/goatsandsoda/2015/02/11/385396431/the-50-most-effective-ways-to-transform-the-developing-world','https://n.pr/1Qky1m5'],'extract'=>[],'homepage'=>'https://www.npr.org/','host'=>['npr.org','n.pr'],'iframe'=>['height'=>228,'max-width'=>800,'src'=>'//www.npr.org/player/embed/{@i}/{@m}','width'=>'100%'],'name'=>'NPR','scrape'=>[['extract'=>['!player/embed/(?\'i\'\\d+)/(?\'m\'\\d+)!'],'header'=>'Cookie: trackingChoice=false; choiceVersion=1','match'=>['!npr\\.org/[/\\w]+/\\d+!','!n\\.pr/\\w!']]],'tags'=>['podcasts']],
'nytimes'=>['attributes'=>[],'example'=>['https://www.nytimes.com/video/magazine/100000003166834/small-plates.html','https://www.nytimes.com/video/technology/personaltech/100000002907606/soylent-taste-test.html','https://www.nytimes.com/video/2012/12/17/business/100000001950744/how-wal-mart-conquered-teotihuacan.html','https://movies.nytimes.com/movie/131154/Crooklyn/trailers'],'extract'=>['!nytimes\\.com/video/[a-z]+/(?:[a-z]+/)?(?\'id\'\\d+)!','!nytimes\\.com/video/\\d+/\\d+/\\d+/[a-z]+/(?\'id\'\\d+)!'],'homepage'=>'https://www.nytimes.com/video/','host'=>['nytimes.com'],'iframe'=>['height'=>400,'src'=>'//graphics8.nytimes.com/video/players/offsite/index.html?videoId={@id}','width'=>585],'name'=>'The New York Times Video','scrape'=>[['extract'=>['!/video/movies/(?\'id\'\\d+)!'],'match'=>['!nytimes\\.com/movie(?:s/movie)?/(?\'playlist\'\\d+)/[-\\w]+/trailers!'],'url'=>'http://www.nytimes.com/svc/video/api/playlist/{@playlist}?externalId=true']],'tags'=>['movies','news']],
'odysee'=>['attributes'=>['name'=>['filterChain'=>['#url'],'required'=>false],'path'=>['filterChain'=>['#url'],'required'=>false]],'example'=>'https://odysee.com/@veritasium:f/the-secret-of-synchronization:2','extract'=>['#odysee\\.com/(?:\\$/\\w+/)?(?\'name\'[^:/]+)[:/](?\'id\'\\w{40})#','#odysee\\.com/(?\'path\'@[^:/]+:\\w/[^:/]+:\\w)#'],'homepage'=>'https://odysee.com/','host'=>['odysee.com'],'iframe'=>['src'=>'https://odysee.com/$/embed/<xsl:choose><xsl:when test="@id"><xsl:choose><xsl:when test="@name"><xsl:value-of select="@name"/></xsl:when><xsl:otherwise>-</xsl:otherwise></xsl:choose>/<xsl:value-of select="@id"/></xsl:when><xsl:otherwise><xsl:value-of select="@path"/></xsl:otherwise></xsl:choose>'],'name'=>'Odysee','scrape'=>[['extract'=>['#"contentUrl".*api/\\w+/streams/\\w+/(?\'name\'[^/]+)/(?\'id\'\\w{40})#'],'match'=>['#odysee\\.com/@[^/:]+:\\w+/.#']]],'tags'=>['videos']],
'on3'=>['attributes'=>[],'example'=>'https://www.on3.com/db/christian-jones-150372/industry-comparison/','extract'=>['!/db/(?:[-\\w]*-)?(?\'id\'[0-9]+)/industry-comparison/!'],'homepage'=>'https://www.on3.com/db/','host'=>['on3.com'],'iframe'=>['data-s9e-livepreview-ignore-attrs'=>'style','height'=>476,'onload'=>'let b=this.contentWindow;window.addEventListener(\'message\',a=>{{a.source===b&&a.data.height&&(this.style.height=+a.data.height+20+\'px\')}});b.postMessage(\'\',\'*\')','src'=>'https://embed.on3.com/db/{@id}/industry-comparison/','width'=>600],'name'=>'On3 DB','scrape'=>[],'tags'=>['sports']],
'orfium'=>['attributes'=>[],'example'=>['https://www.orfium.com/album/24371/everybody-loves-kanye-totom/','https://www.orfium.com/live-set/614763/foof-no-lights-5-foof/','https://www.orfium.com/playlist/511651/electronic-live-sessions-creamtronic/','https://www.orfium.com/track/625367/the-ambience-of-the-goss-vistas/'],'extract'=>['@album/(?\'album_id\'\\d+)@','@playlist/(?\'playlist_id\'\\d+)@','@live-set/(?\'set_id\'\\d+)@','@track/(?\'track_id\'\\d+)@'],'homepage'=>'https://www.orfium.com/','host'=>['orfium.com'],'iframe'=>['height'=>'<xsl:choose><xsl:when test="@album_id">550</xsl:when><xsl:otherwise>275</xsl:otherwise></xsl:choose>','max-width'=>900,'src'=>'https://www.orfium.com/embedded/<xsl:choose><xsl:when test="@album_id">album/<xsl:value-of select="@album_id"/></xsl:when><xsl:when test="@playlist_id">playlist/<xsl:value-of select="@playlist_id"/></xsl:when><xsl:when test="@set_id">live-set/<xsl:value-of select="@set_id"/></xsl:when><xsl:otherwise>track/<xsl:value-of select="@track_id"/></xsl:otherwise></xsl:choose>','width'=>'100%'],'name'=>'Orfium','scrape'=>[],'tags'=>['music']],
'pastebin'=>['attributes'=>[],'example'=>'https://pastebin.com/9jEf44nc','extract'=>['@pastebin\\.com/(?!u/)(?:\\w+(?:\\.php\\?i=|/))?(?\'id\'\\w+)@'],'homepage'=>'https://pastebin.com/','host'=>['pastebin.com'],'iframe'=>['height'=>300,'scrolling'=>'','src'=>'//pastebin.com/embed_iframe.php?i={@id}','style'=>['resize'=>'vertical'],'width'=>'100%'],'name'=>'Pastebin','scrape'=>[]],
'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'=>'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/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']],
Expand Down
23 changes: 23 additions & 0 deletions src/Plugins/MediaEmbed/Configurator/sites/on3.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<site name="On3 DB" homepage="https://www.on3.com/db/">
<example>https://www.on3.com/db/christian-jones-150372/industry-comparison/</example>

<tags><tag>sports</tag></tags>

<host>on3.com</host>
<extract>!/db/(?:[-\w]*-)?(?'id'[0-9]+)/industry-comparison/!</extract>
<!--
let contentWindow = this.contentWindow;
window.addEventListener(
'message',
(e) =>
{
if (e.source === contentWindow && e.data.height)
{
this.style.height = ((+e.data.height) + 20) + 'px';
}
}
);
contentWindow.postMessage('', '*');
-->
<iframe width="600" height="476" src="https://embed.on3.com/db/{@id}/industry-comparison/" onload="let b=this.contentWindow;window.addEventListener('message',a=&gt;{{a.source===b&amp;&amp;a.data.height&amp;&amp;(this.style.height=+a.data.height+20+'px')}});b.postMessage('','*')" data-s9e-livepreview-ignore-attrs="style"/>
</site>
18 changes: 18 additions & 0 deletions tests/Plugins/MediaEmbed/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2841,6 +2841,24 @@ function ($configurator)
$configurator->MediaEmbed->add('odysee');
}
],
[
'https://www.on3.com/db/naeem-offord-156248/industry-comparison/',
'<r><ON3 id="156248">https://www.on3.com/db/naeem-offord-156248/industry-comparison/</ON3></r>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('on3');
}
],
[
'https://embed.on3.com/db/naeem-offord-156248/industry-comparison/',
'<r><ON3 id="156248">https://embed.on3.com/db/naeem-offord-156248/industry-comparison/</ON3></r>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('on3');
}
],
[
'https://www.orfium.com/album/24371/everybody-loves-kanye-totom/',
'<r><ORFIUM album_id="24371">https://www.orfium.com/album/24371/everybody-loves-kanye-totom/</ORFIUM></r>',
Expand Down

0 comments on commit 487e3c4

Please sign in to comment.