config.php: add WIP embedding_2

This commit is contained in:
Zankaria 2025-03-17 00:30:35 +01:00
parent 698451a6d5
commit 4850a8ddd3

View file

@ -1265,6 +1265,36 @@
$config['embed_width'] = 300;
$config['embed_height'] = 246;
/**
* Replacement parameters:
* - $1-$N: matched arguments from 'match_regex'.
* - %%thumbnail_path%%: Path to the downloaded thumbnail.
*/
$config['embedding_2'] = [
[
'match_regex' => '/^(?:(?:https?:)?\/\/)?((?:www|m)\.)?(?:(?:youtube(?:-nocookie)?\.com|youtu\.be))(?:\/(?:[\w\-]+\?v=|embed\/|live\/|v\/)?)([\w\-]{11})((?:\?|\&)\S+)?$/i',
'type' => 'regex',
'thumbnail_url' => 'https://img.youtube.com/vi/$2/0.jpg',
'html' => '<div class="video-container" data-video-id="$2" data-iframe-width="360" data-iframe-height="202">
<a href="https://youtu.be/$2" target="_blank" class="file">
<img style="width:360px;height:202px;object-fit:cover" src="%%thumbnail_path%%" class="post-image"/>
</a>
</div>'
],
[
'match_regex' => '/^https?:\/\/(\w+\.)?tiktok\.com\/@[a-z0-9\-_]+\/video\/([0-9]+)\?.*$/i',
'type' => 'oembed',
'provider' => 'https://www.youtube.com/oembed',
'thumb_width' => 288,
'thumb_height' => 512,
'html' => '<div class="tiktok-embed">
<a href="%%embed_url%%" target="_blank" class="file">
<img style="width:360px;height:202px;object-fit:cover" src="%%thumbnail_path%%" class="post-image"/>
</a>
</div>'
]
];
/*
* ====================
* Error messages