Skip to content

Commit 01dbe41

Browse files
committed
MediaEmbed: added Medal
1 parent 9735bf2 commit 01dbe41

File tree

6 files changed

+51
-39
lines changed

6 files changed

+51
-39
lines changed

docs/Plugins/MediaEmbed/Using_default_sites.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ echo count($configurator->MediaEmbed->defaultSites), " sites remaining.\n";
7777
```
7878
Does YouTube exist? yes
7979
What about now? no
80-
136 sites remaining.
80+
137 sites remaining.
8181
0 sites remaining.
8282
```
8383

docs/testdox.txt

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7311,6 +7311,7 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
73117311
[x] Parsing tests with data set #346
73127312
[x] Parsing tests with data set #347
73137313
[x] Parsing tests with data set #348
7314+
[x] Parsing tests with data set #349
73147315
[x] Parsing tests (JavaScript) with data set #0
73157316
[x] Parsing tests (JavaScript) with data set #1
73167317
[x] Parsing tests (JavaScript) with data set #2
@@ -7660,6 +7661,7 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
76607661
[x] Parsing tests (JavaScript) with data set #346
76617662
[x] Parsing tests (JavaScript) with data set #347
76627663
[x] Parsing tests (JavaScript) with data set #348
7664+
[x] Parsing tests (JavaScript) with data set #349
76637665
[x] Parsing+rendering tests with data set #0
76647666
[x] Parsing+rendering tests with data set #1
76657667
[x] Parsing+rendering tests with data set #2
@@ -8006,39 +8008,39 @@ Unparser (s9e\TextFormatter\Tests\Unparser)
80068008
[x] Characters outside Unicode's BMP are decoded
80078009

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

80228024
Curl (s9e\TextFormatter\Tests\Utils\Http\Clients\Curl)
8023-
[x] Uses gzip by default if ext/zlib is availble
8024-
[x] Sends custom headers
8025-
[x] Resets custom headers between requests
8026-
[x] post() sends the request body if set
8027-
[x] post() sends no request body if not set
8028-
[x] post() automatically sets Content-Length if a request body is set
8029-
[x] get() returns the response error
8030-
[x] get() returns headers if returnHeaders is true
8025+
[ ] Uses gzip by default if ext/zlib is availble
8026+
[ ] Sends custom headers
8027+
[ ] Resets custom headers between requests
8028+
[ ] post() sends the request body if set
8029+
[ ] post() sends no request body if not set
8030+
[ ] post() automatically sets Content-Length if a request body is set
8031+
[ ] get() returns the response error
8032+
[ ] get() returns headers if returnHeaders is true
80318033

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

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

src/Bundles/MediaPack.php

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

src/Bundles/MediaPack/Renderer.php

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

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
7373
'liveleak'=>['attributes'=>[],'example'=>'https://www.liveleak.com/view?t=yIcw_1520190567','extract'=>['!liveleak\\.com/(?:e/|view\\?i=)(?\'id\'\\w+)!'],'homepage'=>'https://www.liveleak.com/','host'=>['liveleak.com'],'iframe'=>['src'=>'//www.liveleak.com/e/{@id}'],'name'=>'Liveleak','scrape'=>[['extract'=>['!liveleak\\.com/e/(?\'id\'\\w+)!'],'match'=>['!liveleak\\.com/view\\?t=!']]],'tags'=>['videos']],
7474
'mailru'=>['attributes'=>[],'example'=>['https://my.mail.ru/corp/auto/video/testdrive/34.html','https://my.mail.ru/mail/alenka1957/video/1/7.html'],'extract'=>[],'homepage'=>'https://my.mail.ru/','host'=>['my.mail.ru'],'iframe'=>['src'=>'https://my.mail.ru/video/embed/{@id}'],'name'=>'Mail.Ru','scrape'=>[['extract'=>['!"itemId": ?"?(?\'id\'\\d+)!'],'match'=>['!my\\.mail\\.ru/\\w+/\\w+/video/\\w+/\\d!']]],'tags'=>['.ru']],
7575
'mastodon'=>['attributes'=>['host'=>['required'=>true]],'example'=>'https://mastodon.social/@HackerNewsBot/100181134752056592','extract'=>['#//(?\'host\'[-.\\w]+)/(?:web/)?(?:@|users/)(?\'name\'\\w+)/(?:posts/|statuses/)?(?\'id\'\\d+)#'],'helper'=>'s9e\\TextFormatter\\Plugins\\MediaEmbed\\Configurator\\SiteHelpers\\MastodonHelper','homepage'=>'https://mastodon.social/','host'=>['mastodon.social'],'iframe'=>['data-s9e-livepreview-ignore-attrs'=>'style','height'=>300,'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/mastodon.min.html#<xsl:value-of select="@name"/><xsl:if test="@host and@host!=\'mastodon.social\'">@<xsl:value-of select="@host"/></xsl:if>/<xsl:value-of select="@id"/>','width'=>550],'name'=>'Mastodon','oembed'=>['endpoint'=>'https://mastodon.social/api/oembed','scheme'=>'https://mastodon.social/@{@name}/{@id}'],'scrape'=>[['extract'=>['#"url":"https://(?\'host\'[-.\\w]+)/@(?\'name\'\\w+)/(?\'id\'\\d+)"#'],'match'=>['#^(?\'origin\'https://[^/]+)/(?:web/)?(?:@\\w+@[-.\\w]+|statuses)/(?\'id\'\\d+)#'],'url'=>'{@origin}/api/v1/statuses/{@id}']],'tags'=>['social']],
76+
'medal'=>['attributes'=>[],'example'=>'https://medal.tv/games/ark-survival-ascended/clips/lG3cmPexf3-J3ZbLX?invite=X','extract'=>['!medal\\.tv/(?:.*?/)?clips?/(?\'id\'[-\\w]+)!'],'homepage'=>'https://medal.tv/','host'=>['medal.tv'],'iframe'=>['src'=>'//medal.tv/clip/{@id}'],'name'=>'Medal','scrape'=>[],'tags'=>['gaming']],
7677
'medium'=>['attributes'=>[],'example'=>'https://medium.com/@donnydonny/team-internet-is-about-to-win-net-neutrality-and-they-didnt-need-googles-help-e7e2cf9b8a95','extract'=>['#medium\\.com/(?:s/\\w+/|@?[-\\w]+/)?(?:[%\\w]+-)*(?\'id\'[0-9a-f]+)(?![%\\w])#'],'homepage'=>'https://medium.com/','host'=>['medium.com'],'iframe'=>['data-s9e-livepreview-ignore-attrs'=>'style','height'=>316,'max-width'=>900,'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/medium.min.html#{@id}','width'=>'100%'],'name'=>'Medium','scrape'=>[],'tags'=>['blogging']],
7778
'megaphone'=>['amp'=>['custom-element'=>'amp-megaphone','src'=>'https://cdn.ampproject.org/v0/amp-megaphone-0.1.js','template'=>'<amp-megaphone layout="fixed-height" height="200" data-episode="{@id}"><xsl:if test="$MEDIAEMBED_THEME=\'light\'"><xsl:attribute name="data-light"/></xsl:if></amp-megaphone>'],'attributes'=>[],'example'=>['https://cms.megaphone.fm/channel/lockedonheat?selected=LKN8165322853','https://player.megaphone.fm/LKN8165322853'],'extract'=>['@megaphone\\.fm/.*?\\?(?:e|selected)=(?\'id\'\\w+)@','@(?:dcs|player|traffic)\\.megaphone\\.fm/(?\'id\'\\w+)@','@megaphone\\.link/(?\'id\'\\w+)@'],'homepage'=>'https://megaphone.fm/','host'=>['megaphone.fm','megaphone.link'],'iframe'=>['height'=>200,'max-width'=>900,'src'=>'https://player.megaphone.fm/<xsl:value-of select="@id"/><xsl:if test="$MEDIAEMBED_THEME=\'light\'">?light=true</xsl:if>','width'=>'100%'],'name'=>'Megaphone','scrape'=>[],'tags'=>['podcasts']],
7879
'metacafe'=>['attributes'=>[],'example'=>'https://www.metacafe.com/watch/10785282/chocolate_treasure_chest_epic_meal_time/','extract'=>['!metacafe\\.com/watch/(?\'id\'\\d+)!'],'homepage'=>'https://www.metacafe.com/','host'=>['metacafe.com'],'iframe'=>['src'=>'//www.metacafe.com/embed/{@id}/'],'name'=>'Metacafe','scrape'=>[],'tags'=>['videos']],

tests/Plugins/MediaEmbed/ParserTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2675,6 +2675,15 @@ function ($configurator)
26752675
$configurator->registeredVars['MediaEmbed.hosts']['infosec.exchange'] = 'mastodon';
26762676
}
26772677
],
2678+
[
2679+
'https://medal.tv/games/ark-survival-ascended/clips/lG3cmPexf3-J3ZbLX?invite=X',
2680+
'<r><MEDAL id="lG3cmPexf3-J3ZbLX">https://medal.tv/games/ark-survival-ascended/clips/lG3cmPexf3-J3ZbLX?invite=X</MEDAL></r>',
2681+
[],
2682+
function ($configurator)
2683+
{
2684+
$configurator->MediaEmbed->add('medal');
2685+
}
2686+
],
26782687
[
26792688
'https://medium.com/@donnydonny/team-internet-is-about-to-win-net-neutrality-and-they-didnt-need-googles-help-e7e2cf9b8a95',
26802689
'<r><MEDIUM id="e7e2cf9b8a95">https://medium.com/@donnydonny/team-internet-is-about-to-win-net-neutrality-and-they-didnt-need-googles-help-e7e2cf9b8a95</MEDIUM></r>',

0 commit comments

Comments
 (0)