Skip to content

Commit

Permalink
MediaEmbed: updated BBC News
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Aug 20, 2020
1 parent 79c359e commit 5aa06cc
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 97 deletions.
2 changes: 1 addition & 1 deletion docs/Plugins/MediaEmbed/Sites.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</tr>
<tr title="BBC News" id="bbcnews">
<td style="font-size:75%"><code>bbcnews</code></td>
<td style="font-size:50%">https://www.bbc.com/news/video_and_audio/must_see/42847060/calls-to-clean-off-banksy-mural-in-hull<br/>https://www.bbc.co.uk/news/av/world-africa-48141248/fifteen-year-old-nigerian-builds-small-scale-construction-machines</td>
<td style="font-size:50%">https://www.bbc.com/news/video_and_audio/must_see/42847060/calls-to-clean-off-banksy-mural-in-hull<br/>https://www.bbc.co.uk/news/av/world-africa-48141248/fifteen-year-old-nigerian-builds-small-scale-construction-machines<br/>https://www.bbc.co.uk/news/av/embed/p0783sg7/48125671</td>
</tr>
<tr title="BitChute" id="bitchute">
<td style="font-size:75%"><code>bitchute</code></td>
Expand Down
12 changes: 8 additions & 4 deletions docs/testdox.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5483,9 +5483,6 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Scraping tests with data set #60
[x] Scraping tests with data set #61
[x] Scraping tests with data set #62
[x] Scraping tests with data set #63
[x] Scraping tests with data set #64
[x] Scraping tests with data set #65
[x] Scraping+rendering tests with data set #0
[x] Scraping+rendering tests with data set #1
[x] Scraping+rendering tests with data set #2
Expand All @@ -5498,7 +5495,6 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Scraping+rendering tests with data set #9
[x] Scraping+rendering tests with data set #10
[x] Scraping+rendering tests with data set #11
[x] Scraping+rendering tests with data set #12
[x] Legacy rendering tests with data set #0
[x] Legacy rendering tests with data set #1
[x] Legacy rendering tests with data set #2
Expand All @@ -5512,6 +5508,7 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Legacy rendering tests with data set #10
[x] Legacy rendering tests with data set #11
[x] Legacy rendering tests with data set #12
[x] Legacy rendering tests with data set #13
[x] Parsing tests with data set #0
[x] Parsing tests with data set #1
[x] Parsing tests with data set #2
Expand Down Expand Up @@ -5797,6 +5794,8 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing tests with data set #282
[x] Parsing tests with data set #283
[x] Parsing tests with data set #284
[x] Parsing tests with data set #285
[x] Parsing tests with data set #286
[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 @@ -6082,6 +6081,8 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing tests (JavaScript) with data set #282
[x] Parsing tests (JavaScript) with data set #283
[x] Parsing tests (JavaScript) with data set #284
[x] Parsing tests (JavaScript) with data set #285
[x] Parsing tests (JavaScript) with data set #286
[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 Expand Up @@ -6168,6 +6169,7 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing+rendering tests with data set #83
[x] Parsing+rendering tests with data set #84
[x] Parsing+rendering tests with data set #85
[x] Parsing+rendering tests with data set #86

Configurator (s9e\TextFormatter\Tests\Plugins\PipeTables\Configurator)
[x] Creates TABLE, TBODY, TD, TH, THEAD and TR tags
Expand Down Expand Up @@ -7186,6 +7188,7 @@ PHP (s9e\TextFormatter\Tests\Configurator\RendererGenerators\PHP)
[x] Tests from plugins with data set #291
[x] Tests from plugins with data set #292
[x] Tests from plugins with data set #293
[x] Tests from plugins with data set #294
[x] Tests from plugins (Quick renderer) with data set #0
[x] Tests from plugins (Quick renderer) with data set #1
[x] Tests from plugins (Quick renderer) with data set #2
Expand Down Expand Up @@ -7480,6 +7483,7 @@ PHP (s9e\TextFormatter\Tests\Configurator\RendererGenerators\PHP)
[x] Tests from plugins (Quick renderer) with data set #291
[x] Tests from plugins (Quick renderer) with data set #292
[x] Tests from plugins (Quick renderer) with data set #293
[x] Tests from plugins (Quick renderer) with data set #294
[x] Creates a Quick renderer if $enableQuickRenderer is true
[x] Does not create a Quick renderer if $enableQuickRenderer is false

Expand Down
50 changes: 25 additions & 25 deletions src/Bundles/MediaPack.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 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 @@ -29,7 +29,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
</xsl:choose>
','width'=>'100%'],'test'=>'@mode=\'album\'']],'example'=>['https://www.audiomack.com/your-music-fix/song/jammin-kungs-remix-1','https://www.audiomack.com/chance-the-rapper/album/acid-rap'],'extract'=>['!audiomack\\.com/(?\'mode\'album|song)/(?\'artist\'[-\\w]+)/(?\'title\'[-\\w]+)!','!audiomack\\.com/(?\'artist\'[-\\w]+)/(?\'mode\'album|song)/(?\'title\'[-\\w]+)!'],'homepage'=>'https://www.audiomack.com/','host'=>['audiomack.com'],'name'=>'Audiomack','scrape'=>[],'tags'=>['music']],
'bandcamp'=>['attributes'=>[],'example'=>['https://proleter.bandcamp.com/album/curses-from-past-times-ep','https://proleter.bandcamp.com/track/downtown-irony','https://therunons.bandcamp.com/track/still-feel'],'extract'=>[],'homepage'=>'https://bandcamp.com/','host'=>['bandcamp.com'],'iframe'=>['height'=>400,'src'=>'//bandcamp.com/EmbeddedPlayer/size=large/minimal=true/<xsl:choose><xsl:when test="@album_id">album=<xsl:value-of select="@album_id"/><xsl:if test="@track_num">/t=<xsl:value-of select="@track_num"/></xsl:if></xsl:when><xsl:otherwise>track=<xsl:value-of select="@track_id"/></xsl:otherwise></xsl:choose>','width'=>400],'name'=>'Bandcamp','scrape'=>[['extract'=>['!/album=(?\'album_id\'\\d+)!'],'match'=>['!bandcamp\\.com/album/.!']],['extract'=>['!"album_id":(?\'album_id\'\\d+)!','!"track_num":(?\'track_num\'\\d+)!','!/track=(?\'track_id\'\\d+)!'],'match'=>['!bandcamp\\.com/track/.!']]],'tags'=>['music']],
'bbcnews'=>['attributes'=>['id'=>['filterChain'=>['stripslashes']]],'example'=>['https://www.bbc.com/news/video_and_audio/must_see/42847060/calls-to-clean-off-banksy-mural-in-hull','https://www.bbc.co.uk/news/av/world-africa-48141248/fifteen-year-old-nigerian-builds-small-scale-construction-machines'],'extract'=>['@bbc\\.co(?:m|\\.uk)/news/av/embed/(?\'id\'[-\\\\\\w/]+)@'],'homepage'=>'https://www.bbc.com/news/video_and_audio/headlines/','host'=>['bbc.co.uk','bbc.com'],'iframe'=>['src'=>'//www.bbc.com<xsl:choose><xsl:when test="starts-with(@id,\'av/\')">/news/<xsl:value-of select="@id"/>/embed</xsl:when><xsl:when test="starts-with(@playlist,\'/news/\')and contains(@playlist,\'A\')"><xsl:value-of select="substring-before(@playlist,\'A\')"/>/embed</xsl:when><xsl:otherwise>/news/av/embed/<xsl:value-of select="@id"/></xsl:otherwise></xsl:choose>'],'name'=>'BBC News','scrape'=>[['extract'=>['@bbc\\.co(?:m|\\.uk)\\\\?/news\\\\?/av\\\\?/embed\\\\?/(?\'id\'[-\\\\\\w/]+)@'],'match'=>['@bbc\\.co(?:m|\\.uk)/news/(?:av(?!/embed)|video_and_audio)/\\w@']]],'tags'=>['news']],
'bbcnews'=>['attributes'=>[],'example'=>['https://www.bbc.com/news/video_and_audio/must_see/42847060/calls-to-clean-off-banksy-mural-in-hull','https://www.bbc.co.uk/news/av/world-africa-48141248/fifteen-year-old-nigerian-builds-small-scale-construction-machines','https://www.bbc.co.uk/news/av/embed/p0783sg7/48125671'],'extract'=>['@bbc\\.co(?:m|\\.uk)/news/\\w+/(?:\\w+-)+(?\'id\'\\d+)@','@bbc\\.co(?:m|\\.uk)/news/\\w+/embed/(?\'id\'\\w+/\\d+)@','@bbc\\.co(?:m|\\.uk)/news/\\w+/\\w+/(?\'id\'\\d+)@'],'homepage'=>'https://www.bbc.com/news/video_and_audio/headlines/','host'=>['bbc.co.uk','bbc.com'],'iframe'=>['src'=>'//www.bbc.com/news/av/video-<xsl:choose><xsl:when test="starts-with(@playlist,\'/news/\')"><xsl:value-of select="substring-after(@playlist,\'/news/\')"/></xsl:when><xsl:when test="contains(@id,\'/\')"><xsl:value-of select="substring-after(@id,\'/\')"/></xsl:when><xsl:otherwise><xsl:value-of select="@id"/></xsl:otherwise></xsl:choose>/embed'],'name'=>'BBC News','scrape'=>[],'tags'=>['news']],
'bitchute'=>['attributes'=>[],'example'=>'https://www.bitchute.com/video/y9AejeZ2vD0/','extract'=>['@bitchute\\.com/video/(?\'id\'\\w+)@'],'homepage'=>'https://www.bitchute.com/','host'=>['bitchute.com'],'iframe'=>['src'=>'https://www.bitchute.com/embed/{@id}/'],'name'=>'BitChute','scrape'=>[],'tags'=>['videos']],
'bleacherreport'=>['attributes'=>[],'example'=>'https://bleacherreport.com/articles/2687569-how-bell-brown-have-shattered-records-on-steelers-historic-playoff-run','extract'=>[],'homepage'=>'https://bleacherreport.com/videos','host'=>['bleacherreport.com'],'iframe'=>['height'=>320,'src'=>'//bleacherreport.com/video_embed?id={@id}&library=video-cms','width'=>320],'name'=>'Bleacher Report videos','scrape'=>[['extract'=>['!id="video-(?\'id\'[-\\w]+)!','!video_embed\\?id=(?\'id\'[-\\w]+)!'],'match'=>['!/articles/.!']]],'tags'=>['sports']],
'break'=>['attributes'=>[],'example'=>'https://www.break.com/video/video-game-playing-frog-wants-more-2278131','extract'=>['!break\\.com/video/.*-(?\'id\'\\d+)$!'],'homepage'=>'https://www.break.com/','host'=>['break.com'],'iframe'=>['height'=>280,'src'=>'//break.com/embed/{@id}','width'=>464],'name'=>'Break','scrape'=>[],'tags'=>['entertainment']],
Expand Down
29 changes: 11 additions & 18 deletions src/Plugins/MediaEmbed/Configurator/sites/bbcnews.xml
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
<site name="BBC News" homepage="https://www.bbc.com/news/video_and_audio/headlines/">
<example>https://www.bbc.com/news/video_and_audio/must_see/42847060/calls-to-clean-off-banksy-mural-in-hull</example>
<example>https://www.bbc.co.uk/news/av/world-africa-48141248/fifteen-year-old-nigerian-builds-small-scale-construction-machines</example>
<example>https://www.bbc.co.uk/news/av/embed/p0783sg7/48125671</example>

<tags><tag>news</tag></tags>

<attributes>
<id filterChain="stripslashes"/>
</attributes>

<host>bbc.co.uk</host>
<host>bbc.com</host>
<extract>@bbc\.co(?:m|\.uk)/news/av/embed/(?'id'[-\\\w/]+)@</extract>
<scrape>
<match>@bbc\.co(?:m|\.uk)/news/(?:av(?!/embed)|video_and_audio)/\w@</match>
<extract>@bbc\.co(?:m|\.uk)\\?/news\\?/av\\?/embed\\?/(?'id'[-\\\w/]+)@</extract>
</scrape>
<extract>@bbc\.co(?:m|\.uk)/news/\w+/(?:\w+-)+(?'id'\d+)@</extract>
<extract>@bbc\.co(?:m|\.uk)/news/\w+/embed/(?'id'\w+/\d+)@</extract>
<extract>@bbc\.co(?:m|\.uk)/news/\w+/\w+/(?'id'\d+)@</extract>
<iframe>
<src><![CDATA[
<xsl:text>//www.bbc.com</xsl:text>
<xsl:text>//www.bbc.com/news/av/video-</xsl:text>
<xsl:choose>
<xsl:when test="starts-with(@id, 'av/')">
<xsl:text>/news/</xsl:text>
<xsl:value-of select="@id"/>
<xsl:text>/embed</xsl:text>
<xsl:when test="starts-with(@playlist, '/news/')">
<xsl:value-of select="substring-after(@playlist, '/news/')"/>
</xsl:when>
<xsl:when test="starts-with(@playlist, '/news/') and contains(@playlist, 'A')">
<xsl:value-of select="substring-before(@playlist, 'A')"/>
<xsl:text>/embed</xsl:text>
<xsl:when test="contains(@id, '/')">
<xsl:value-of select="substring-after(@id, '/')"/>
</xsl:when>
<xsl:otherwise>/news/av/embed/<xsl:value-of select="@id"/></xsl:otherwise>
<xsl:otherwise><xsl:value-of select="@id"/></xsl:otherwise>
</xsl:choose>
<xsl:text>/embed</xsl:text>
]]></src>
</iframe>
</site>
92 changes: 46 additions & 46 deletions tests/Plugins/MediaEmbed/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,30 +523,6 @@ public function getScrapingTests()
// $configurator->MediaEmbed->add('bandcamp');
// }
// ],
[
'http://www.bbc.com/news/video_and_audio/must_see/42847060/calls-to-clean-off-banksy-mural-in-hull',
'(<r><BBCNEWS id="\\w+/42847060">http://www.bbc.com/news/video_and_audio/must_see/42847060/calls-to-clean-off-banksy-mural-in-hull</BBCNEWS></r>)',
[],
function ($configurator)
{
$configurator->registeredVars['cacheDir'] = __DIR__ . '/../../.cache';
$configurator->MediaEmbed->add('bbcnews');
},
null,
'assertMatchesRegularExpression'
],
[
'https://www.bbc.co.uk/news/av/world-africa-48141248/fifteen-year-old-nigerian-builds-small-scale-construction-machines',
'(<r><BBCNEWS id="\\w+/48141248">https://www.bbc.co.uk/news/av/world-africa-48141248/fifteen-year-old-nigerian-builds-small-scale-construction-machines</BBCNEWS></r>)',
[],
function ($configurator)
{
$configurator->registeredVars['cacheDir'] = __DIR__ . '/../../.cache';
$configurator->MediaEmbed->add('bbcnews');
},
null,
'assertMatchesRegularExpression'
],
// [
// 'http://bleacherreport.com/articles/2415420-creating-a-starting-xi-of-the-most-overrated-players-in-world-football',
// '<r><BLEACHERREPORT id="dtYjVhdDr5492cyQTjVPDcM--Mg2rJj5">http://bleacherreport.com/articles/2415420-creating-a-starting-xi-of-the-most-overrated-players-in-world-football</BLEACHERREPORT></r>',
Expand Down Expand Up @@ -940,16 +916,16 @@ function ($configurator)
$configurator->MediaEmbed->add('internetarchive');
}
],
[
'https://www.kaltura.com/tiny/b5tib',
'<r><KALTURA entry_id="0_ekjebl7h" partner_id="1581781" sp="158178100" uiconf_id="20490561">https://www.kaltura.com/tiny/b5tib</KALTURA></r>',
[],
function ($configurator)
{
$configurator->registeredVars['cacheDir'] = __DIR__ . '/../../.cache';
$configurator->MediaEmbed->add('kaltura');
}
],
// [
// 'https://www.kaltura.com/tiny/b5tib',
// '<r><KALTURA entry_id="0_ekjebl7h" partner_id="1581781" sp="158178100" uiconf_id="20490561">https://www.kaltura.com/tiny/b5tib</KALTURA></r>',
// [],
// function ($configurator)
// {
// $configurator->registeredVars['cacheDir'] = __DIR__ . '/../../.cache';
// $configurator->MediaEmbed->add('kaltura');
// }
// ],
[
'https://vcu.mediaspace.kaltura.com/media/t/1_hu0rc15a',
'<r><KALTURA entry_id="1_hu0rc15a" partner_id="1888231" sp="188823100" uiconf_id="28242311">https://vcu.mediaspace.kaltura.com/media/t/1_hu0rc15a</KALTURA></r>',
Expand Down Expand Up @@ -1436,17 +1412,6 @@ public function getScrapingRenderingTests()
// $configurator->MediaEmbed->add('bandcamp');
// }
// ],
[
'http://www.bbc.com/news/video_and_audio/must_see/42847060/calls-to-clean-off-banksy-mural-in-hull',
'(<span data-s9e-mediaembed="bbcnews" style="display:inline-block;width:100%;max-width:640px"><span style="display:block;overflow:hidden;position:relative;padding-bottom:56.25%"><iframe allowfullscreen="" loading="lazy" scrolling="no" style="border:0;height:100%;left:0;position:absolute;width:100%" src="//www.bbc.com/news/av/embed/\\w+/42847060"></iframe></span></span>)',
[],
function ($configurator)
{
$configurator->registeredVars['cacheDir'] = __DIR__ . '/../../.cache';
$configurator->MediaEmbed->add('bbcnews');
},
'assertMatchesRegularExpression'
],
// [
// 'http://www.comedycentral.com/video-clips/uu5qz4/key-and-peele-dueling-hats',
// '<span data-s9e-mediaembed="comedycentral" style="display:inline-block;width:100%;max-width:640px"><span style="display:block;overflow:hidden;position:relative;padding-bottom:56.25%"><iframe allowfullscreen="" loading="lazy" scrolling="no" src="//media.mtvnservices.com/embed/mgid:arc:video:comedycentral.com:bc275e2f-48e3-46d9-b095-0254381497ea" style="border:0;height:100%;left:0;position:absolute;width:100%"></iframe></span></span>',
Expand Down Expand Up @@ -1787,6 +1752,24 @@ function ($configurator)
$configurator->MediaEmbed->add('bbcnews');
}
],
[
'http://www.bbc.com/news/video_and_audio/must_see/42847060/calls-to-clean-off-banksy-mural-in-hull',
'<r><BBCNEWS id="42847060">http://www.bbc.com/news/video_and_audio/must_see/42847060/calls-to-clean-off-banksy-mural-in-hull</BBCNEWS></r>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('bbcnews');
}
],
[
'https://www.bbc.co.uk/news/av/world-africa-48141248/fifteen-year-old-nigerian-builds-small-scale-construction-machines',
'<r><BBCNEWS id="48141248">https://www.bbc.co.uk/news/av/world-africa-48141248/fifteen-year-old-nigerian-builds-small-scale-construction-machines</BBCNEWS></r>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('bbcnews');
}
],
[
'https://www.bitchute.com/video/y9AejeZ2vD0/',
'<r><BITCHUTE id="y9AejeZ2vD0">https://www.bitchute.com/video/y9AejeZ2vD0/</BITCHUTE></r>',
Expand Down Expand Up @@ -4317,6 +4300,15 @@ function ($configurator)
$configurator->MediaEmbed->add('audiomack');
}
],
[
'http://www.bbc.com/news/video_and_audio/must_see/42847060/calls-to-clean-off-banksy-mural-in-hull',
'<span data-s9e-mediaembed="bbcnews" style="display:inline-block;width:100%;max-width:640px"><span style="display:block;overflow:hidden;position:relative;padding-bottom:56.25%"><iframe allowfullscreen="" loading="lazy" scrolling="no" style="border:0;height:100%;left:0;position:absolute;width:100%" src="//www.bbc.com/news/av/video-42847060/embed"></iframe></span></span>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('bbcnews');
}
],
[
'http://www.cbsnews.com/video/watch/?id=50156501n',
'<span data-s9e-mediaembed="cbsnews" style="display:inline-block;width:100%;max-width:640px"><span style="display:block;overflow:hidden;position:relative;padding-bottom:62.5%;padding-bottom:calc(56.25% + 40px)"><object data="//i.i.cbsi.com/cnwk.1d/av/video/cbsnews/atlantis2/cbsnews_player_embed.swf" style="height:100%;left:0;position:absolute;width:100%" type="application/x-shockwave-flash" typemustmatch=""><param name="allowfullscreen" value="true"><param name="flashvars" value="si=254&amp;contentValue=50156501"></object></span></span>',
Expand Down Expand Up @@ -5003,7 +4995,15 @@ function ($configurator)
],
[
'<r><BBCNEWS ad_site="/news/business" playlist="/news/business-29149086A" poster="/media/images/77590000/jpg/_77590973_mapopgetty.jpg">http://www.bbc.com/news/business-29149086</BBCNEWS></r>',
'<span data-s9e-mediaembed="bbcnews" style="display:inline-block;width:100%;max-width:640px"><span style="display:block;overflow:hidden;position:relative;padding-bottom:56.25%"><iframe allowfullscreen="" loading="lazy" scrolling="no" style="border:0;height:100%;left:0;position:absolute;width:100%" src="//www.bbc.com/news/business-29149086/embed"></iframe></span></span>',
'<span data-s9e-mediaembed="bbcnews" style="display:inline-block;width:100%;max-width:640px"><span style="display:block;overflow:hidden;position:relative;padding-bottom:56.25%"><iframe allowfullscreen="" loading="lazy" scrolling="no" style="border:0;height:100%;left:0;position:absolute;width:100%" src="//www.bbc.com/news/av/video-business-29149086A/embed"></iframe></span></span>',
function ($configurator)
{
$configurator->MediaEmbed->add('bbcnews');
}
],
[
'<r><BBCNEWS id="p0784g1m/48141248">https://www.bbc.co.uk/news/av/world-africa-48141248/fifteen-year-old-nigerian-builds-small-scale-construction-machines</BBCNEWS></r>',
'<span data-s9e-mediaembed="bbcnews" style="display:inline-block;width:100%;max-width:640px"><span style="display:block;overflow:hidden;position:relative;padding-bottom:56.25%"><iframe allowfullscreen="" loading="lazy" scrolling="no" style="border:0;height:100%;left:0;position:absolute;width:100%" src="//www.bbc.com/news/av/video-48141248/embed"></iframe></span></span>',
function ($configurator)
{
$configurator->MediaEmbed->add('bbcnews');
Expand Down

0 comments on commit 5aa06cc

Please sign in to comment.