Skip to content

Commit e0aea78

Browse files
committed
MediaEmbed: updated Imgur
1 parent 05febbb commit e0aea78

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

docs/testdox.txt

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8002,39 +8002,39 @@ Unparser (s9e\TextFormatter\Tests\Unparser)
80028002
[x] Characters outside Unicode's BMP are decoded
80038003

80048004
Cached (s9e\TextFormatter\Tests\Utils\Http\Clients\Cached)
8005-
[ ] Settings from the proxied client are copied
8006-
[ ] Settings from the caching client are copied to the proxied client
8007-
[ ] Can work without a cache dir
8008-
[ ] Works with a cache
8009-
[ ] Uses gzip by default if ext/zlib is availble
8010-
[ ] Sends custom headers
8011-
[ ] Resets custom headers between requests
8012-
[ ] post() sends the request body if set
8013-
[ ] post() sends no request body if not set
8014-
[ ] post() automatically sets Content-Length if a request body is set
8015-
[ ] get() returns the response error
8016-
[ ] get() returns headers if returnHeaders is true
8005+
[x] Settings from the proxied client are copied
8006+
[x] Settings from the caching client are copied to the proxied client
8007+
[x] Can work without a cache dir
8008+
[x] Works with a cache
8009+
[x] Uses gzip by default if ext/zlib is availble
8010+
[x] Sends custom headers
8011+
[x] Resets custom headers between requests
8012+
[x] post() sends the request body if set
8013+
[x] post() sends no request body if not set
8014+
[x] post() automatically sets Content-Length if a request body is set
8015+
[x] get() returns the response error
8016+
[x] get() returns headers if returnHeaders is true
80178017

80188018
Curl (s9e\TextFormatter\Tests\Utils\Http\Clients\Curl)
8019-
[ ] Uses gzip by default if ext/zlib is availble
8020-
[ ] Sends custom headers
8021-
[ ] Resets custom headers between requests
8022-
[ ] post() sends the request body if set
8023-
[ ] post() sends no request body if not set
8024-
[ ] post() automatically sets Content-Length if a request body is set
8025-
[ ] get() returns the response error
8026-
[ ] get() returns headers if returnHeaders is true
8019+
[x] Uses gzip by default if ext/zlib is availble
8020+
[x] Sends custom headers
8021+
[x] Resets custom headers between requests
8022+
[x] post() sends the request body if set
8023+
[x] post() sends no request body if not set
8024+
[x] post() automatically sets Content-Length if a request body is set
8025+
[x] get() returns the response error
8026+
[x] get() returns headers if returnHeaders is true
80278027

80288028
Native (s9e\TextFormatter\Tests\Utils\Http\Clients\Native)
8029-
[ ] Does not send "Accept-Encoding: gzip" if gzip is disabled
8030-
[ ] Uses gzip by default if ext/zlib is availble
8031-
[ ] Sends custom headers
8032-
[ ] Resets custom headers between requests
8033-
[ ] post() sends the request body if set
8034-
[ ] post() sends no request body if not set
8035-
[ ] post() automatically sets Content-Length if a request body is set
8036-
[ ] get() returns the response error
8037-
[ ] get() returns headers if returnHeaders is true
8029+
[x] Does not send "Accept-Encoding: gzip" if gzip is disabled
8030+
[x] Uses gzip by default if ext/zlib is availble
8031+
[x] Sends custom headers
8032+
[x] Resets custom headers between requests
8033+
[x] post() sends the request body if set
8034+
[x] post() sends no request body if not set
8035+
[x] post() automatically sets Content-Length if a request body is set
8036+
[x] get() returns the response error
8037+
[x] get() returns headers if returnHeaders is true
80388038

80398039
Http (s9e\TextFormatter\Tests\Utils\Http)
80408040
[x] getClient() returns an instance of s9e\TextFormatter\Utils\Http\Client

src/Bundles/MediaPack.php

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

src/Plugins/MediaEmbed/Configurator/Collections/CachedDefinitionCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
5858
'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/!']]]],
5959
'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']],
6060
'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']],
61-
'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']],
61+
'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|gallery)/\\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']],
6262
'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']],
6363
'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/(?!share/)(?:[.\\w]+/)?(?: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">#theme=<xsl:value-of select="$MEDIAEMBED_THEME"/></xsl:if>','width'=>542],'name'=>'Instagram','scrape'=>[['extract'=>['#instagram\\.com/(?:p|reel|tv)/(?\'id\'[-\\w]+)#'],'header'=>'User-agent: PHP','match'=>['#instagram.com/share/\\w+/\\w#']]],'source'=>'http://help.instagram.com/513918941996087','tags'=>['social'],'tracking_policy'=>'https://help.instagram.com/1896641480634370'],
6464
'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)/!']]]],

src/Plugins/MediaEmbed/Configurator/sites/imgur.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<tags><tag>images</tag></tags>
1212

1313
<host>imgur.com</host>
14-
<extract>@imgur\.com/(?'id'a/\w+)@</extract>
14+
<extract>@imgur\.com/(?'id'(?:a|gallery)/\w+)@</extract>
1515
<extract>@i\.imgur\.com/(?'id'\w{5,7})[lms]?\.@</extract>
1616
<extract>@imgur\.com/(?!upload\b)(?'id'\w+)(?![\w./])@</extract>
1717
<scrape url="https://api.imgur.com/oembed.xml?url=/{@path}">

0 commit comments

Comments
 (0)