Skip to content

Commit

Permalink
MediaEmbed: added Nacho Video
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Sep 27, 2024
1 parent 22c5386 commit c126dec
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 40 deletions.
4 changes: 4 additions & 0 deletions docs/Plugins/MediaEmbed/Sites.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@
<td><code>msnbc</code></td>
<td>https://www.msnbc.com/ronan-farrow-daily/watch/thats-no-moon--300512323725<br/>https://on.msnbc.com/1qkH62o</td>
</tr>
<tr title="Nacho Video" id="nachovideo">
<td><code>nachovideo</code></td>
<td>https://nachovideo.com/video/35/another-look-getting-outside-of-maps-in-destiny-2-pvp/</td>
</tr>
<tr title="National Geographic Channel" id="natgeochannel">
<td><code>natgeochannel</code></td>
<td>https://channel.nationalgeographic.com/channel/brain-games/videos/jason-silva-on-intuition/<br/>https://channel.nationalgeographic.com/wild/urban-jungle/videos/leopard-in-the-city/</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
132 sites remaining.
133 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 @@ -7291,6 +7291,8 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing tests with data set #340
[x] Parsing tests with data set #341
[x] Parsing tests with data set #342
[x] Parsing tests with data set #343
[x] Parsing tests with data set #344
[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 @@ -7634,6 +7636,8 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing tests (JavaScript) with data set #340
[x] Parsing tests (JavaScript) with data set #341
[x] Parsing tests (JavaScript) with data set #342
[x] Parsing tests (JavaScript) with data set #343
[x] Parsing tests (JavaScript) with data set #344
[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
73 changes: 37 additions & 36 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 @@ -79,6 +79,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
'mlb'=>['attributes'=>[],'example'=>['https://www.mlb.com/video/statcast-stantons-two-homers/c-1898424783','https://m.mlb.com/video/v1205791883'],'extract'=>['#mlb\\.com/video/(?:[-\\w/]+/)?(?:c-|v|[-\\w]+-c)(?\'id\'\\d+)#'],'homepage'=>'https://mlb.com/video/','host'=>['mlb.com'],'iframe'=>['src'=>'https://www.mlb.com/video/share/c-{@id}'],'name'=>'MLB','scrape'=>[],'tags'=>['sports']],
'mrctv'=>['attributes'=>[],'example'=>'https://mrctv.org/videos/cnn-frets-about-tobacco-companies-color-coding-tricks','extract'=>[],'homepage'=>'https://www.mrctv.org/','host'=>['mrctv.org'],'iframe'=>['src'=>'https://www.mrctv.org/embed/{@id}'],'name'=>'MRCTV','scrape'=>[['extract'=>['!mrctv\\.org/embed/(?\'id\'\\d+)!'],'match'=>['!mrctv\\.org/videos/.!']]]],
'msnbc'=>['attributes'=>[],'choose'=>['otherwise'=>['iframe'=>['src'=>'https://www.msnbc.com/msnbc/embedded-video/{@id}']],'when'=>['iframe'=>['padding-height'=>80,'src'=>'//player.theplatform.com/p/7wvmTC/MSNBCEmbeddedOffSite?guid={@id}'],'test'=>'contains(@id, \'_\')']],'example'=>['https://www.msnbc.com/ronan-farrow-daily/watch/thats-no-moon--300512323725','https://on.msnbc.com/1qkH62o'],'extract'=>[],'homepage'=>'https://www.msnbc.com/watch','host'=>['msnbc.com'],'name'=>'MSNBC','scrape'=>[['extract'=>['@embedded-video/(?!undefined)(?\'id\'\\w+)@'],'match'=>['@msnbc\\.com/[-\\w]+/watch/@','@on\\.msnbc\\.com/.@']]],'tags'=>['news']],
'nachovideo'=>['attributes'=>[],'example'=>'https://nachovideo.com/video/35/another-look-getting-outside-of-maps-in-destiny-2-pvp/','extract'=>['!nachovideo\\.com/(?:embed|video)/(?\'id\'\\d+)\\b!'],'homepage'=>'https://nachovideo.com/','host'=>['nachovideo.com'],'iframe'=>['src'=>'https://nachovideo.com/embed/{@id}'],'name'=>'Nacho Video','scrape'=>[],'tags'=>['videos']],
'natgeochannel'=>['attributes'=>[],'example'=>['https://channel.nationalgeographic.com/channel/brain-games/videos/jason-silva-on-intuition/','https://channel.nationalgeographic.com/wild/urban-jungle/videos/leopard-in-the-city/'],'extract'=>['@channel\\.nationalgeographic\\.com/(?\'id\'[-/\\w]+/videos/[-\\w]+)@'],'homepage'=>'https://channel.nationalgeographic.com/','host'=>['channel.nationalgeographic.com'],'iframe'=>['src'=>'//channel.nationalgeographic.com/{@id}/embed/'],'name'=>'National Geographic Channel','scrape'=>[]],
'natgeovideo'=>['attributes'=>[],'example'=>['https://video.nationalgeographic.com/tv/changing-earth','https://video.nationalgeographic.com/video/weirdest-superb-lyrebird'],'extract'=>[],'homepage'=>'https://video.nationalgeographic.com/','host'=>['video.nationalgeographic.com'],'iframe'=>['src'=>'//player.d.nationalgeographic.com/players/ngsvideo/share/?guid={@id}'],'name'=>'National Geographic Video','scrape'=>[['extract'=>['@guid="(?\'id\'[-\\w]+)"@'],'match'=>['@video\\.nationalgeographic\\.com/(?:tv|video)/\\w@']]],'tags'=>['documentaries']],
'nbcnews'=>['attributes'=>[],'example'=>'https://www.nbcnews.com/video/bob-dylan-awarded-nobel-prize-for-literature-785193027834','extract'=>['!nbcnews\\.com/(?:widget/video-embed/|video/[-\\w]+?-)(?\'id\'\\d+)!'],'homepage'=>'https://www.nbcnews.com/video/','host'=>['nbcnews.com'],'iframe'=>['src'=>'//www.nbcnews.com/widget/video-embed/{@id}'],'name'=>'NBC News','scrape'=>[],'tags'=>['news']],
Expand Down
9 changes: 9 additions & 0 deletions src/Plugins/MediaEmbed/Configurator/sites/nachovideo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<site name="Nacho Video" homepage="https://nachovideo.com/">
<example>https://nachovideo.com/video/35/another-look-getting-outside-of-maps-in-destiny-2-pvp/</example>

<tags><tag>videos</tag></tags>

<host>nachovideo.com</host>
<extract>!nachovideo\.com/(?:embed|video)/(?'id'\d+)\b!</extract>
<iframe src="https://nachovideo.com/embed/{@id}"/>
</site>
18 changes: 18 additions & 0 deletions tests/Plugins/MediaEmbed/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2802,6 +2802,24 @@ function ($configurator)
$configurator->MediaEmbed->add('mlb');
}
],
[
'https://nachovideo.com/video/35/another-look-getting-outside-of-maps-in-destiny-2-pvp/',
'<r><NACHOVIDEO id="35">https://nachovideo.com/video/35/another-look-getting-outside-of-maps-in-destiny-2-pvp/</NACHOVIDEO></r>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('nachovideo');
}
],
[
'https://nachovideo.com/embed/35',
'<r><NACHOVIDEO id="35">https://nachovideo.com/embed/35</NACHOVIDEO></r>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('nachovideo');
}
],
[
'http://channel.nationalgeographic.com/channel/brain-games/videos/jason-silva-on-intuition/',
'<r><NATGEOCHANNEL id="channel/brain-games/videos/jason-silva-on-intuition">http://channel.nationalgeographic.com/channel/brain-games/videos/jason-silva-on-intuition/</NATGEOCHANNEL></r>',
Expand Down

0 comments on commit c126dec

Please sign in to comment.