Skip to content

Commit

Permalink
MediaEmbed: updated Imgur
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Mar 18, 2024
1 parent 4e107e1 commit 8946150
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions docs/testdox.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7241,6 +7241,7 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing tests with data set #333
[x] Parsing tests with data set #334
[x] Parsing tests with data set #335
[x] Parsing tests with data set #336
[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 @@ -7577,6 +7578,7 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing tests (JavaScript) with data set #333
[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+rendering tests with data set #0
[x] Parsing+rendering tests with data set #1
[x] Parsing+rendering tests with data set #2
Expand Down
6 changes: 3 additions & 3 deletions src/Bundles/MediaPack.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
'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'=>[],'homepage'=>'https://www.imdb.com/trailers/','host'=>['imdb.com'],'iframe'=>['src'=>'https://www.imdb.com/video/embed/vi{@id}/?autoplay=false&width=640'],'name'=>'IMDb trailers','scrape'=>[['extract'=>['!imdb\\.com/[/\\w]+?/vi(?\'id\'\\d+)!'],'match'=>['!imdb\\.com/[/\\w]+?/vi(?\'id\'\\d+)!'],'url'=>'https://www.imdb.com/video/embed/vi{@id}/']],'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'=>'let c=new MessageChannel;c.port1.onmessage=e=>{{let s=this.style,d=e.data.split(\' \');s.height=d[0]+\'px\';s.width=d[1]+\'px\'}};this.contentWindow.postMessage(\'s9e:init\',\'*\',[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']],
'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/(?!upload\\b)(?\'id\'\\w+)(?![\\w./])@'],'homepage'=>'https://imgur.com/','host'=>['imgur.com'],'iframe'=>['data-s9e-livepreview-ignore-attrs'=>'style','height'=>400,'onload'=>'let c=new MessageChannel;c.port1.onmessage=e=>{{let s=this.style,d=e.data.split(\' \');s.height=d[0]+\'px\';s.width=d[1]+\'px\'}};this.contentWindow.postMessage(\'s9e:init\',\'*\',[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'=>542,'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/instagram.min.html#<xsl:value-of select="@id"/><xsl:if test="$MEDIAEMBED_THEME=\'dark\'">#theme=dark</xsl:if>','width'=>542],'name'=>'Instagram','scrape'=>[],'source'=>'http://help.instagram.com/513918941996087','tags'=>['social'],'tracking_policy'=>'https://help.instagram.com/1896641480634370'],
'internetarchive'=>['attributes'=>['height'=>['defaultValue'=>360,'filterChain'=>['#uint']],'id'=>['filterChain'=>['htmlspecialchars_decode']],'width'=>['defaultValue'=>640,'filterChain'=>['#uint']]],'choose'=>['otherwise'=>['iframe'=>['height'=>'{@height}','src'=>'https://archive.org/embed/{@id}','width'=>'{@width}']],'when'=>['iframe'=>['height'=>170,'max-width'=>640,'src'=>'https://archive.org/embed/{@id}&list_height=150','width'=>'100%'],'test'=>'contains(@id,\'playlist=1\')']],'example'=>['https://archive.org/details/BillGate99','https://archive.org/details/DFTS2014-05-30'],'extract'=>[],'homepage'=>'https://archive.org/','host'=>['archive.org'],'name'=>'Internet Archive','scrape'=>[['extract'=>['!meta property="twitter:player" content="https://archive.org/embed/(?\'id\'[^/"]+)!','!meta property="og:video:width" content="(?\'width\'\\d+)!','!meta property="og:video:height" content="(?\'height\'\\d+)!'],'match'=>['!archive\\.org/(?:details|embed)/!']]]],
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/MediaEmbed/Configurator/sites/imgur.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<host>imgur.com</host>
<extract>@imgur\.com/(?'id'a/\w+)@</extract>
<extract>@i\.imgur\.com/(?'id'\w{5,7})[lms]?\.@</extract>
<extract>@imgur\.com/(?'id'\w+)(?![\w./])@</extract>
<extract>@imgur\.com/(?!upload\b)(?'id'\w+)(?![\w./])@</extract>
<scrape url="https://api.imgur.com/oembed.xml?url=/{@path}">
<match>@imgur\.com/(?![art]/|user/)(?'path'(?:gallery/)?\w+)(?![\w.])@</match>
<extract>@data-id="(?'id'[\w/]+)"@</extract>
Expand Down
9 changes: 9 additions & 0 deletions tests/Plugins/MediaEmbed/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2251,6 +2251,15 @@ function ($configurator)
$configurator->MediaEmbed->add('imgur');
}
],
[
'https://imgur.com/upload',
'<t>https://imgur.com/upload</t>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('imgur');
}
],
[
'http://www.indiegogo.com/projects/513633',
'<r><INDIEGOGO id="513633">http://www.indiegogo.com/projects/513633</INDIEGOGO></r>',
Expand Down

0 comments on commit 8946150

Please sign in to comment.