config.php: better youtube embedding regex

This commit is contained in:
Zankaria 2025-02-12 20:13:41 +01:00
parent 3c282852a3
commit d8cafc8fd8

View file

@ -1196,7 +1196,7 @@
// It's very important that you match the entire input (with ^ and $) or things will not work correctly.
$config['embedding'] = array(
[
'/^https?:\/\/(\w+\.)?youtube\.com\/watch\?v=([a-zA-Z0-9\-_]{10,11})(&.+)?$/i',
'/^(?:(?:https?:)?\/\/)?((?:www|m)\.)?(?:(?:youtube(?:-nocookie)?\.com|youtu\.be))(?:\/(?:[\w\-]+\?v=|embed\/|live\/|v\/)?)([\w\-]{11})((?:\?|\&)\S+)?$/i',
'<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="https://img.youtube.com/vi/$2/0.jpg" class="post-image"/>