Skip to content

Commit

Permalink
MediaEmbed: updated IMDb
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Apr 12, 2021
1 parent 44f22bf commit f801b61
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 72 deletions.
2 changes: 1 addition & 1 deletion docs/Plugins/MediaEmbed/Sites.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
<td style="font-size:75%"><code>ign</code></td>
<td style="font-size:50%">https://www.ign.com/videos/2013/07/12/pokemon-x-version-pokemon-y-version-battle-trailer</td>
</tr>
<tr title="IMDb" id="imdb">
<tr title="IMDb trailers" id="imdb">
<td style="font-size:75%"><code>imdb</code></td>
<td style="font-size:50%">https://www.imdb.com/video/imdb/vi2482677785/<br/>https://www.imdb.com/title/tt2294629/videoplayer/vi2482677785</td>
</tr>
Expand Down
7 changes: 3 additions & 4 deletions docs/testdox.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5493,6 +5493,9 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Scraping tests with data set #58
[x] Scraping tests with data set #59
[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+rendering tests with data set #0
[x] Scraping+rendering tests with data set #1
[x] Scraping+rendering tests with data set #2
Expand Down Expand Up @@ -5853,8 +5856,6 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing tests with data set #306
[x] Parsing tests with data set #307
[x] Parsing tests with data set #308
[x] Parsing tests with data set #309
[x] Parsing tests with data set #310
[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 @@ -6164,8 +6165,6 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing tests (JavaScript) with data set #306
[x] Parsing tests (JavaScript) with data set #307
[x] Parsing tests (JavaScript) with data set #308
[x] Parsing tests (JavaScript) with data set #309
[x] Parsing tests (JavaScript) with data set #310
[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
92 changes: 46 additions & 46 deletions src/Bundles/MediaPack.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
'hudl'=>['attributes'=>['id'=>['required'=>false]],'example'=>['https://www.hudl.com/video/59dfca6090eeac23f0eef838','https://www.hudl.com/athlete/2067184/highlights/163744377','https://www.hudl.com/video/3/323679/57719969842eb243e47883f8'],'extract'=>['!hudl\\.com/athlete/(?\'athlete\'\\d+)/highlights/(?\'highlight\'[\\da-f]+)!','!hudl\\.com/video/\\d+/(?\'athlete\'\\d+)/(?\'highlight\'[\\da-f]+)!','@hudl\\.com/video/(?\'id\'\\w+)(?![\\w/])@'],'homepage'=>'https://www.hudl.com/','host'=>['hudl.com'],'iframe'=>['src'=>'//www.hudl.com/embed/<xsl:choose><xsl:when test="@id">video/<xsl:value-of select="@id"/></xsl:when><xsl:otherwise>athlete/<xsl:value-of select="@athlete"/>/highlights/<xsl:value-of select="@highlight"/></xsl:otherwise></xsl:choose>'],'name'=>'Hudl','scrape'=>[['extract'=>['!hudl\\.com/video/\\d+/(?\'athlete\'\\d+)/(?\'highlight\'[\\da-f]+)!','@hudl\\.com/video/(?\'id\'\\w+)(?![\\w/])@'],'match'=>['!hudl\\.com/v/!']]],'tags'=>['sports']],
'hulu'=>['attributes'=>[],'example'=>'https://www.hulu.com/watch/484180','extract'=>[],'homepage'=>'https://www.hulu.com/','host'=>['hulu.com'],'iframe'=>['src'=>'https://secure.hulu.com/embed/{@id}'],'name'=>'Hulu','scrape'=>[['extract'=>['!eid=(?\'id\'[-\\w]+)!'],'match'=>['!hulu\\.com/watch/!']]]],
'ign'=>['attributes'=>[],'example'=>'https://www.ign.com/videos/2013/07/12/pokemon-x-version-pokemon-y-version-battle-trailer','extract'=>['!(?\'id\'https?://.*?ign\\.com/videos/.+)!i'],'homepage'=>'https://www.ign.com/videos/','host'=>['ign.com'],'iframe'=>['height'=>263,'src'=>'//widgets.ign.com/video/embed/content.html?url={@id}','width'=>468],'name'=>'IGN','scrape'=>[],'tags'=>['gaming']],
'imdb'=>['attributes'=>[],'example'=>['https://www.imdb.com/video/imdb/vi2482677785/','https://www.imdb.com/title/tt2294629/videoplayer/vi2482677785'],'extract'=>['!imdb\\.com/[/\\w]+/vi(?\'id\'\\d+)!'],'homepage'=>'https://www.imdb.com/','host'=>['imdb.com'],'iframe'=>['src'=>'//www.imdb.com/video/imdb/vi{@id}/imdb/embed?autoplay=false&width=640'],'name'=>'IMDb','scrape'=>[],'tags'=>['movies']],
'imdb'=>['attributes'=>[],'example'=>['https://www.imdb.com/video/imdb/vi2482677785/','https://www.imdb.com/title/tt2294629/videoplayer/vi2482677785'],'extract'=>[],'homepage'=>'https://www.imdb.com/trailers/','host'=>['imdb.com'],'iframe'=>['src'=>'//www.imdb.com/video/imdb/vi{@id}/imdb/embed?autoplay=false&width=640'],'name'=>'IMDb trailers','scrape'=>[['extract'=>['!imdb\\.com/[/\\w]+?/vi(?\'id\'\\d+)/[/\\w]*?embed!'],'match'=>['!imdb\\.com/[/\\w]+?/vi(?\'id\'\\d+)!'],'url'=>'https://www.imdb.com/video/imdb/vi{@id}/imdb/embed']],'tags'=>['movies']],
'imgur'=>['amp'=>['custom-element'=>'amp-imgur','src'=>'https://cdn.ampproject.org/v0/amp-imgur-0.1.js','template'=>'<amp-imgur layout="responsive" width="542" height="400" data-imgur-id="{@id}"/>'],'attributes'=>[],'example'=>['https://imgur.com/AsQ0K3P','https://imgur.com/a/9UGCL','https://imgur.com/gallery/9UGCL','https://i.imgur.com/u7Yo0Vy.gifv','https://i.imgur.com/UO1UrIx.mp4'],'extract'=>['@imgur\\.com/(?\'id\'a/\\w+)@','@i\\.imgur\\.com/(?\'id\'\\w{5,7})[lms]?\\.@','@imgur\\.com/(?\'id\'\\w+)(?![\\w./])@'],'homepage'=>'https://imgur.com/','host'=>['imgur.com'],'iframe'=>['data-s9e-livepreview-ignore-attrs'=>'style','height'=>400,'onload'=>'var c=new MessageChannel;c.port1.onmessage=function(e){{var d=e.data.split(\' \');style.height=d[0]+\'px\';style.width=d[1]+\'px\'}};contentWindow.postMessage(\'s9e:init\',\'https://s9e.github.io\',[c.port2])','src'=>'https://s9e.github.io/iframe/2/imgur.min.html#<xsl:if test="@type=\'album\'">a/</xsl:if><xsl:value-of select="@id"/>','width'=>542],'name'=>'Imgur','oembed'=>['endpoint'=>'https://api.imgur.com/oembed.json','scheme'=>'https://imgur.com/{@id}'],'scrape'=>[['extract'=>['@data-id="(?\'id\'[\\w/]+)"@'],'match'=>['@imgur\\.com/(?![art]/|user/)(?\'path\'(?:gallery/)?\\w+)(?![\\w.])@'],'url'=>'https://api.imgur.com/oembed.xml?url=/{@path}']],'tags'=>['images']],
'indiegogo'=>['attributes'=>[],'example'=>'https://www.indiegogo.com/projects/gameheart-redesigned','extract'=>['!indiegogo\\.com/projects/(?\'id\'[-\\w]+)!'],'homepage'=>'https://www.indiegogo.com/','host'=>['indiegogo.com'],'iframe'=>['height'=>445,'src'=>'//www.indiegogo.com/project/{@id}/embedded','width'=>222],'name'=>'Indiegogo','scrape'=>[],'tags'=>['fundraising']],
'instagram'=>['amp'=>['custom-element'=>'amp-instagram','src'=>'https://cdn.ampproject.org/v0/amp-instagram-0.1.js','template'=>'<amp-instagram layout="responsive" width="540" height="540" data-captioned="" data-shortcode="{@id}"/>'],'attributes'=>[],'example'=>['https://instagram.com/p/gbGaIXBQbn/','https://www.instagram.com/tv/BkQjCfsBIzi/'],'extract'=>['!instagram\\.com/(?:p|reel|tv)/(?\'id\'[-\\w]+)!'],'homepage'=>'https://instagram.com/','host'=>['instagram.com'],'iframe'=>['data-s9e-livepreview-ignore-attrs'=>'style','height'=>540,'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/instagram.min.html#{@id}','style'=>['background'=>'url(https://www.instagram.com/static/images/ico/favicon.svg/fc72dd4bfde8.svg) no-repeat 50% 50% / 50%'],'width'=>540],'name'=>'Instagram','scrape'=>[],'source'=>'http://help.instagram.com/513918941996087','tags'=>['social']],
Expand Down
7 changes: 5 additions & 2 deletions src/Plugins/MediaEmbed/Configurator/sites/imdb.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<site name="IMDb" homepage="https://www.imdb.com/">
<site name="IMDb trailers" homepage="https://www.imdb.com/trailers/">
<example>https://www.imdb.com/video/imdb/vi2482677785/</example>
<example>https://www.imdb.com/title/tt2294629/videoplayer/vi2482677785</example>

<tags><tag>movies</tag></tags>

<host>imdb.com</host>
<extract>!imdb\.com/[/\w]+/vi(?'id'\d+)!</extract>
<scrape url="https://www.imdb.com/video/imdb/vi{@id}/imdb/embed">
<match>!imdb\.com/[/\w]+?/vi(?'id'\d+)!</match>
<extract>!imdb\.com/[/\w]+?/vi(?'id'\d+)/[/\w]*?embed!</extract>
</scrape>
<iframe src="//www.imdb.com/video/imdb/vi{@id}/imdb/embed?autoplay=false&amp;width=640"/>
</site>
48 changes: 30 additions & 18 deletions tests/Plugins/MediaEmbed/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,36 @@ function ($configurator)
// $configurator->MediaEmbed->add('hulu');
// }
// ],
[
'http://www.imdb.com/video/epk/vi387296537/',
'<r><IMDB id="387296537">http://www.imdb.com/video/epk/vi387296537/</IMDB></r>',
[],
function ($configurator)
{
$configurator->registeredVars['cacheDir'] = __DIR__ . '/../../.cache';
$configurator->MediaEmbed->add('imdb');
}
],
[
'http://www.imdb.com/title/tt2294629/videoplayer/vi2482677785',
'<r><IMDB id="2482677785">http://www.imdb.com/title/tt2294629/videoplayer/vi2482677785</IMDB></r>',
[],
function ($configurator)
{
$configurator->registeredVars['cacheDir'] = __DIR__ . '/../../.cache';
$configurator->MediaEmbed->add('imdb');
}
],
[
'https://www.imdb.com/video/vi4085711129',
'<t>https://www.imdb.com/video/vi4085711129</t>',
[],
function ($configurator)
{
$configurator->registeredVars['cacheDir'] = __DIR__ . '/../../.cache';
$configurator->MediaEmbed->add('imdb');
}
],
[
'http://imgur.com/gallery/9UGCL',
'<r><IMGUR id="a/9UGCL">http://imgur.com/gallery/9UGCL</IMGUR></r>',
Expand Down Expand Up @@ -2632,24 +2662,6 @@ function ($configurator)
$configurator->MediaEmbed->add('ign');
}
],
[
'http://www.imdb.com/video/epk/vi387296537/',
'<r><IMDB id="387296537">http://www.imdb.com/video/epk/vi387296537/</IMDB></r>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('imdb');
}
],
[
'http://www.imdb.com/title/tt2294629/videoplayer/vi2482677785',
'<r><IMDB id="2482677785">http://www.imdb.com/title/tt2294629/videoplayer/vi2482677785</IMDB></r>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('imdb');
}
],
[
'http://i.imgur.com/AsQ0K3P.jpg',
'<r><IMGUR id="AsQ0K3P">http://i.imgur.com/AsQ0K3P.jpg</IMGUR></r>',
Expand Down

0 comments on commit f801b61

Please sign in to comment.