Skip to content

Commit

Permalink
MediaEmbed: updated Medium
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed May 25, 2024
1 parent 3a31a34 commit 34912a8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/testdox.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7264,6 +7264,7 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing tests with data set #336
[x] Parsing tests with data set #337
[x] Parsing tests with data set #338
[x] Parsing tests with data set #339
[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 @@ -7603,6 +7604,7 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing tests (JavaScript) with data set #336
[x] Parsing tests (JavaScript) with data set #337
[x] Parsing tests (JavaScript) with data set #338
[x] Parsing tests (JavaScript) with data set #339
[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
4 changes: 2 additions & 2 deletions src/Bundles/MediaPack.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
'livestream'=>['attributes'=>[],'example'=>['https://new.livestream.com/jbtvlive/musicmarathon','https://livestream.com/ccscsl/USChessChampionships/videos/83267610','https://livestre.am/58XNV'],'extract'=>['!livestream\\.com/accounts/(?\'account_id\'\\d+)/events/(?\'event_id\'\\d+)!','!/videos/(?\'video_id\'\\d+)!','!original\\.livestream\\.com/(?\'channel\'\\w+)/video\\?clipId=(?\'clip_id\'[-\\w]+)!'],'homepage'=>'https://new.livestream.com/','host'=>['livestre.am','livestream.com'],'iframe'=>['src'=>'//<xsl:choose><xsl:when test="@clip_id">cdn.livestream.com/embed/<xsl:value-of select="@channel"/>?layout=4&amp;autoplay=false&amp;clip=<xsl:value-of select="@clip_id"/></xsl:when><xsl:otherwise>livestream.com/accounts/<xsl:value-of select="@account_id"/>/events/<xsl:value-of select="@event_id"/><xsl:if test="@video_id">/videos/<xsl:value-of select="@video_id"/></xsl:if>/player?autoPlay=false</xsl:otherwise></xsl:choose>'],'name'=>'Livestream','scrape'=>[['extract'=>['!accounts/(?\'account_id\'\\d+)/events/(?\'event_id\'\\d+)!'],'match'=>['@livestream\\.com/(?!accounts/\\d+/events/\\d)@']],['extract'=>['!//original\\.livestream\\.com/(?\'channel\'\\w+)/video/(?\'clip_id\'[-\\w]+)!'],'match'=>['!livestre.am!']]],'tags'=>['livestreaming','videos']],
'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']],
'mastodon'=>['attributes'=>['host'=>['required'=>true]],'example'=>'https://mastodon.social/@HackerNewsBot/100181134752056592','extract'=>['#//(?\'host\'[-.\\w]+)/(?:web/)?(?:@|users/)(?\'name\'\\w+)/(?:posts/|statuses/)?(?\'id\'\\d+)#'],'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']],
'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']],
'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']],
'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']],
'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']],
'mixcloud'=>['attributes'=>[],'example'=>'https://www.mixcloud.com/OneTakeTapes/timsch-one-take-tapes-2/','extract'=>['@mixcloud\\.com/(?!categories|tag)(?\'id\'[-\\w]+/[^/&]+)/@'],'homepage'=>'https://www.mixcloud.com/','host'=>['mixcloud.com'],'iframe'=>['height'=>120,'max-width'=>900,'src'=>'//www.mixcloud.com/widget/iframe/?feed=%2F<xsl:value-of select="@id"/>%2F&amp;light=<xsl:if test="$MEDIAEMBED_THEME!=\'dark\'">1</xsl:if>','width'=>'100%'],'name'=>'Mixcloud','oembed'=>['endpoint'=>'https://www.mixcloud.com/oembed/','scheme'=>'https://www.mixcloud.com/{@id}'],'scrape'=>[],'tags'=>['music']],
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/MediaEmbed/Configurator/sites/medium.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<tags><tag>blogging</tag></tags>

<host>medium.com</host>
<extract>#medium\.com/(?:s/\w+/|@?[-\w]+/)?(?:\w+-)*(?'id'[0-9a-f]+)(?!\w)#</extract>
<extract>#medium\.com/(?:s/\w+/|@?[-\w]+/)?(?:[%\w]+-)*(?'id'[0-9a-f]+)(?![%\w])#</extract>
<iframe width="100%" height="316" max-width="900" src="https://s9e.github.io/iframe/2/medium.min.html#{@id}" onload="let c=new MessageChannel;c.port1.onmessage=e=>this.style.height=e.data+'px';this.contentWindow.postMessage('s9e:init','*',[c.port2])" data-s9e-livepreview-ignore-attrs="style"/>
</site>
9 changes: 9 additions & 0 deletions tests/Plugins/MediaEmbed/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2570,6 +2570,15 @@ function ($configurator)
$configurator->MediaEmbed->add('medium');
}
],
[
'https://medium.com/datapath/c%C3%B3mo-usar-read-ai-transcribe-y-mejora-tus-reuniones-virtuales-93ca8cc3ba66',
'<r><MEDIUM id="93ca8cc3ba66">https://medium.com/datapath/c%C3%B3mo-usar-read-ai-transcribe-y-mejora-tus-reuniones-virtuales-93ca8cc3ba66</MEDIUM></r>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('medium');
}
],
[
'https://cms.megaphone.fm/channel/lockedonheat?selected=LKN8165322853',
'<r><MEGAPHONE id="LKN8165322853">https://cms.megaphone.fm/channel/lockedonheat?selected=LKN8165322853</MEGAPHONE></r>',
Expand Down

0 comments on commit 34912a8

Please sign in to comment.