Skip to content

Commit

Permalink
MediaEmbed: added SiteHelpers API
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Jul 24, 2024
1 parent a025c6e commit 613f636
Show file tree
Hide file tree
Showing 18 changed files with 213 additions and 55 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
"test": "phpunit --exclude-group ''"
},
"extra": {
"version": "2.17.4-dev"
"version": "2.18.0-dev"
}
}
14 changes: 14 additions & 0 deletions docs/Internals/API_changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
See also [general changes](Changes.md).


## 2.18.0

The following classes have moved namespace and are (silently) deprecated:

- s9e\TextFormatter\Plugins\MediaEmbed\Configurator\AbstractConfigurableHostHelper
- s9e\TextFormatter\Plugins\MediaEmbed\Configurator\MastodonHelper
- s9e\TextFormatter\Plugins\MediaEmbed\Configurator\XenForoHelper

The preferred way to access helpers is through the plugin's configurator. For example:

- `$configurator->MediaEmbed->getSiteHelper('mastodon')`
- `$configurator->MediaEmbed->getSiteHelper('xenforo')`


## 2.2.0

The following methods are silently deprecated and will be removed in the next major release:
Expand Down
14 changes: 4 additions & 10 deletions docs/Plugins/MediaEmbed/Federated_sites.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ The default Mastodon media site can be customized with additional hosts. This ca
```php
$configurator = new s9e\TextFormatter\Configurator;

// Add the Mastodon media site
$configurator->MediaEmbed->add('mastodon');

// Use MastodonHelper to add 'infosec.exchange' as a supported instance
$mastodonHelper = new s9e\TextFormatter\Plugins\MediaEmbed\Configurator\MastodonHelper($configurator);
// Use the Mastodon helper to add 'infosec.exchange' as a supported instance
$mastodonHelper = $configurator->MediaEmbed->getSiteHelper('mastodon');
$mastodonHelper->addHost('infosec.exchange');

// Get an instance of the parser and the renderer
Expand All @@ -36,11 +33,8 @@ While not technically a federated platform, XenForo 2.3+ allows embedding conten
```php
$configurator = new s9e\TextFormatter\Configurator;

// Add the Mastodon media site
$configurator->MediaEmbed->add('xenforo');

// Use XenForoHelper to add 'xenforo.com' as an authorized source
$xenforoHelper = new s9e\TextFormatter\Plugins\MediaEmbed\Configurator\XenForoHelper($configurator);
// Use the XenForo helper to add 'xenforo.com' as an authorized source
$xenforoHelper = $configurator->MediaEmbed->getSiteHelper('xenforo');
$xenforoHelper->addHost('xenforo.com');

// Get an instance of the parser and the renderer
Expand Down
7 changes: 6 additions & 1 deletion docs/testdox.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6757,9 +6757,13 @@ Xml File Definition Collection (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Confi
[x] Other default attribute values are left as strings
[x] Attributes' "required" property is cast to bool

Mastodon Helper (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Configurator\MastodonHelper)
Mastodon Helper (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Configurator\SiteHelpers\MastodonHelper)
[x] addHost() normalizes the host
[x] addHost() adds the Mastodon media site if it's not enabled yet
[x] setHosts() resets previously allowed hosts

Xen Foro Helper (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Configurator\SiteHelpers\XenForoHelper)
[x] addHost() adds the XenForo media site if it's not enabled yet

Template Builder (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Configurator\TemplateBuilder)
[x] getTemplate() returns an empty string by default
Expand Down Expand Up @@ -6814,6 +6818,7 @@ Configurator (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Configurator)
[x] asConfig() returns a an array containing a "regexp" element by default, if any site was added
[x] asConfig() creates a regexp if a site has a "host"
[x] asConfig() returns '://' as quickMatch
[x] getSiteHelper('mastodon') returns the Mastodon helper

Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] The MEDIA tag can be effectively disabled
Expand Down
8 changes: 8 additions & 0 deletions src/Plugins/MediaEmbed/Configurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use s9e\TextFormatter\Configurator\JavaScript\Dictionary;
use s9e\TextFormatter\Plugins\ConfiguratorBase;
use s9e\TextFormatter\Plugins\MediaEmbed\Configurator\Collections\CachedDefinitionCollection;
use s9e\TextFormatter\Plugins\MediaEmbed\Configurator\SiteHelpers\AbstractSiteHelper;
use s9e\TextFormatter\Plugins\MediaEmbed\Configurator\TemplateBuilder;

class Configurator extends ConfiguratorBase
Expand Down Expand Up @@ -136,6 +137,13 @@ public function add($siteId, ?array $siteConfig = null)
return $tag;
}

public function getSiteHelper(string $siteId): AbstractSiteHelper
{
$className = $this->defaultSites->get($siteId)['helper'];

return new $className($this->configurator);
}

/**
* Return the list of configured sites
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,8 @@
*/
namespace s9e\TextFormatter\Plugins\MediaEmbed\Configurator;

use function strtolower;
use s9e\TextFormatter\Configurator;
use s9e\TextFormatter\Plugins\MediaEmbed\Configurator\SiteHelpers\AbstractConfigurableHostHelper as ParentClass;

abstract class AbstractConfigurableHostHelper
abstract class AbstractConfigurableHostHelper extends ParentClass
{
/**
* @var Configurator
*/
protected Configurator $configurator;

public function __construct(Configurator $configurator)
{
$this->configurator = $configurator;
}

public function addHost(string $host): void
{
$siteId = $this->getSiteId();
if (!isset($this->configurator->registeredVars['MediaEmbed.sites'][$siteId]))
{
$this->configurator->MediaEmbed->add($siteId);
}

$host = strtolower($host);
$this->configurator->registeredVars['MediaEmbed.hosts'][$host] = $siteId;
}

abstract protected function getSiteId(): string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
'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']],
'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']],
'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']],
'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']],
Expand Down Expand Up @@ -139,7 +139,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
'wsj'=>['attributes'=>[],'example'=>['https://www.wsj.com/video/nba-players-primp-with-pedicures/9E476D54-6A60-4F3F-ABC1-411014552DE6.html','https://live.wsj.com/#!09FB2B3B-583E-4284-99D8-FEF6C23BE4E2','https://live.wsj.com/video/seahawks-qb-russell-wilson-on-super-bowl-win/9B3DF790-9D20-442C-B564-51524B06FD26.html'],'extract'=>['@wsj\\.com/[^#]*#!(?\'id\'[-0-9A-F]{36})@','@wsj\\.com/video/[^/]+/(?\'id\'[-0-9A-F]{36})@'],'homepage'=>'https://www.wsj.com/video/','host'=>['wsj.com'],'iframe'=>['src'=>'//video-api.wsj.com/api-video/player/iframe.html?guid={@id}'],'name'=>'The Wall Street Journal Online','scrape'=>[['extract'=>['@wsj\\.com/video/[^/]+/(?\'id\'[-0-9A-F]{36})@'],'match'=>['@on\\.wsj\\.com/\\w@']]],'tags'=>['news']],
'xboxclips'=>['attributes'=>[],'example'=>'https://gameclips.io/boulderBaby5568/035a50fa-2d54-4820-aa44-f0f43a873308','extract'=>['@(?:gameclips\\.io|xboxclips\\.com)/(?!game/)(?\'user\'[^/]+)/(?!screenshots/)(?\'id\'[-0-9a-f]+)@'],'homepage'=>'https://gameclips.io/','host'=>['gameclips.io','xboxclips.com'],'iframe'=>['height'=>315,'src'=>'//gameclips.io/{@user}/{@id}/embed','width'=>560],'name'=>'GameClips.io','scrape'=>[],'tags'=>['gaming']],
'xboxdvr'=>['attributes'=>[],'example'=>'https://gamerdvr.com/gamer/LOXITANE/video/12463958','extract'=>['!(?:gamer|xbox)dvr\\.com/gamer/(?\'user\'[^/]+)/video/(?\'id\'\\d+)!'],'homepage'=>'https://gamerdvr.com/','host'=>['gamerdvr.com','xboxdvr.com'],'iframe'=>['src'=>'//gamerdvr.com/gamer/{@user}/video/{@id}/embed'],'name'=>'Gamer DVR','scrape'=>[],'tags'=>['gaming']],
'xenforo'=>['attributes'=>['content_id'=>['filterChain'=>['#identifier'],'required'=>false],'post_id'=>['filterChain'=>['#uint'],'required'=>false],'profile_post_id'=>['filterChain'=>['#uint'],'required'=>false],'resource_id'=>['filterChain'=>['#uint'],'required'=>false],'thread_id'=>['filterChain'=>['#uint'],'required'=>false],'url'=>['filterChain'=>['#url'],'required'=>true],'xfmg_album_id'=>['filterChain'=>['#uint'],'required'=>false]],'example'=>'https://xenforo.com/community/threads/embed-your-content-anywhere.217381/','extract'=>['!^(?\'url\'https://.*?/)media/albums/(?:[-\\w]+\\.)?(?\'xfmg_album_id\'\\d+)!','!^(?\'url\'https://.*?/)(?:members/[-.\\w]+/#profile-post-|profile-posts/)(?\'profile_post_id\'\\d+)!','!^(?\'url\'https://.*?/)resources/(?:[-\\w]+\\.)?(?\'resource_id\'\\d+)!','!^(?\'url\'https://.*?/)threads/(?:[-\\w]+\\.)?(?\'thread_id\'\\d+)/(?:page-\\d+)?#?(?:post-(?\'post_id\'\\d+))?!','!^(?\'url\'https://.*?/)embed\\.php\\?content=(?\'content_id\'[-\\w]+)!'],'host'=>[],'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/xenforo.min.html#<xsl:value-of select="@url"/><xsl:choose><xsl:when test="@profile_post_id">profile-posts/<xsl:value-of select="@profile_post_id"/></xsl:when><xsl:when test="@resource_id">resources/<xsl:value-of select="@resource_id"/></xsl:when><xsl:when test="@xfmg_album_id">media/albums/<xsl:value-of select="@xfmg_album_id"/></xsl:when><xsl:otherwise>threads/<xsl:value-of select="@thread_id"/><xsl:if test="@post_id">/post-<xsl:value-of select="@post_id"/></xsl:if></xsl:otherwise></xsl:choose>','width'=>'100%'],'name'=>'XenForo','scrape'=>[],'tags'=>['social']],
'xenforo'=>['attributes'=>['content_id'=>['filterChain'=>['#identifier'],'required'=>false],'post_id'=>['filterChain'=>['#uint'],'required'=>false],'profile_post_id'=>['filterChain'=>['#uint'],'required'=>false],'resource_id'=>['filterChain'=>['#uint'],'required'=>false],'thread_id'=>['filterChain'=>['#uint'],'required'=>false],'url'=>['filterChain'=>['#url'],'required'=>true],'xfmg_album_id'=>['filterChain'=>['#uint'],'required'=>false]],'example'=>'https://xenforo.com/community/threads/embed-your-content-anywhere.217381/','extract'=>['!^(?\'url\'https://.*?/)media/albums/(?:[-\\w]+\\.)?(?\'xfmg_album_id\'\\d+)!','!^(?\'url\'https://.*?/)(?:members/[-.\\w]+/#profile-post-|profile-posts/)(?\'profile_post_id\'\\d+)!','!^(?\'url\'https://.*?/)resources/(?:[-\\w]+\\.)?(?\'resource_id\'\\d+)!','!^(?\'url\'https://.*?/)threads/(?:[-\\w]+\\.)?(?\'thread_id\'\\d+)/(?:page-\\d+)?#?(?:post-(?\'post_id\'\\d+))?!','!^(?\'url\'https://.*?/)embed\\.php\\?content=(?\'content_id\'[-\\w]+)!'],'helper'=>'s9e\\TextFormatter\\Plugins\\MediaEmbed\\Configurator\\SiteHelpers\\XenForoHelper','host'=>[],'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/xenforo.min.html#<xsl:value-of select="@url"/><xsl:choose><xsl:when test="@profile_post_id">profile-posts/<xsl:value-of select="@profile_post_id"/></xsl:when><xsl:when test="@resource_id">resources/<xsl:value-of select="@resource_id"/></xsl:when><xsl:when test="@xfmg_album_id">media/albums/<xsl:value-of select="@xfmg_album_id"/></xsl:when><xsl:otherwise>threads/<xsl:value-of select="@thread_id"/><xsl:if test="@post_id">/post-<xsl:value-of select="@post_id"/></xsl:if></xsl:otherwise></xsl:choose>','width'=>'100%'],'name'=>'XenForo','scrape'=>[],'tags'=>['social']],
'youku'=>['attributes'=>[],'example'=>'https://v.youku.com/v_show/id_XMzY0NTMyMTgxMg==.html','extract'=>['!youku\\.com/v(?:_show|ideo)/id_(?\'id\'\\w+=*)!'],'homepage'=>'https://www.youku.com/','host'=>['youku.com'],'iframe'=>['src'=>'//player.youku.com/embed/{@id}'],'name'=>'Youku','scrape'=>[],'tags'=>['.cn']],
'youmaker'=>['attributes'=>[],'example'=>['https://www.youmaker.com/v/EnDXOWo8OOvQ','https://www.youmaker.com/video/b3ce8457-2cbe-4661-84ec-829fa8fe0754'],'extract'=>['!youmaker\\.com/(?:embed|v(?:ideo)?)/(?\'id\'[-a-z0-9]+)!i'],'homepage'=>'https://www.youmaker.com/','host'=>['youmaker.com'],'iframe'=>['src'=>'https://www.youmaker.com/embed/{@id}'],'name'=>'YouMaker','scrape'=>[],'tags'=>['videos']],
'youtube'=>['amp'=>['custom-element'=>'amp-youtube','src'=>'https://cdn.ampproject.org/v0/amp-youtube-0.1.js','template'=>'<amp-youtube layout="responsive" width="640" height="360" data-param-list="{@list}" data-param-start="{@t}" data-videoid="{@id}"/>'],'attributes'=>['id'=>['filterChain'=>['#identifier'],'required'=>false],'t'=>['filterChain'=>['#timestamp']]],'example'=>['https://www.youtube.com/watch?v=-cEzsCAzTak','https://youtu.be/-cEzsCAzTak','https://www.youtube.com/watch?feature=player_detailpage&v=jofNR_WkoCE#t=40','https://www.youtube.com/watch?v=pC35x6iIPmo&list=PLOU2XLYxmsIIxJrlMIY5vYXAFcO5g83gA'],'extract'=>['!youtube\\.com/(?:watch.*?v=|(?:embed|live|shorts|v)/|attribution_link.*?v%3D)(?\'id\'[-\\w]+)!','!youtube-nocookie\\.com/embed/(?\'id\'[-\\w]+)!','!youtu\\.be/(?\'id\'[-\\w]+)!','@[#&?]t(?:ime_continue)?=(?\'t\'\\d[\\dhms]*)@','![&?]list=(?\'list\'[-\\w]+)!'],'homepage'=>'https://www.youtube.com/','host'=>['youtube-nocookie.com','youtube.com','youtu.be'],'iframe'=>['src'=>'https://www.youtube.com/embed/<xsl:value-of select="@id"/><xsl:choose><xsl:when test="@clip">?clip=<xsl:value-of select="@clip"/>&amp;clipt=<xsl:value-of select="@clipt"/></xsl:when><xsl:otherwise><xsl:if test="@list">?list=<xsl:value-of select="@list"/></xsl:if><xsl:if test="@t"><xsl:choose><xsl:when test="@list">&amp;</xsl:when><xsl:otherwise>?</xsl:otherwise></xsl:choose>start=<xsl:value-of select="@t"/></xsl:if></xsl:otherwise></xsl:choose>','style'=>['background'=>'url(https://i.ytimg.com/vi/{@id}/hqdefault.jpg) 50% 50% / cover']],'name'=>'YouTube','oembed'=>['endpoint'=>'https://www.youtube.com/oembed','scheme'=>'https://www.youtube.com/watch?v={@id}'],'scrape'=>[['extract'=>['@/embed/(?\'id\'[-\\w]+)\\?clip=(?\'clip\'[-\\w]+)&amp;clipt=(?\'clipt\'[-\\w]+)@'],'match'=>['@youtube\\.com/clip/.@']]],'source'=>'https://support.google.com/youtube/bin/answer.py?hl=en&answer=171780','tags'=>['livestreaming','videos']]
Expand Down
8 changes: 3 additions & 5 deletions src/Plugins/MediaEmbed/Configurator/MastodonHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
*/
namespace s9e\TextFormatter\Plugins\MediaEmbed\Configurator;

class MastodonHelper extends AbstractConfigurableHostHelper
use s9e\TextFormatter\Plugins\MediaEmbed\Configurator\SiteHelpers\MastodonHelper as ParentClass;

class MastodonHelper extends ParentClass
{
protected function getSiteId(): string
{
return 'mastodon';
}
}
Loading

0 comments on commit 613f636

Please sign in to comment.