1
0
mirror of https://github.com/Kovah/LinkAce.git synced 2025-04-21 23:42:10 +02:00

Update regex to correctly check for youtube links (#263)

This commit is contained in:
Kovah 2021-04-19 16:42:05 +02:00
parent b4cc711b5a
commit cf986ba80f
No known key found for this signature in database
GPG Key ID: AAAA031BA9830D7B

View File

@ -114,7 +114,7 @@ class HtmlMeta
*/
if (is_null($thumbnail)) {
if (str_contains($this->url, 'youtube.com') && str_contains($this->url, 'v=')) {
preg_match('/v=([a-zA-Z0-9]+)/', $this->url, $matched);
preg_match('/v=([a-zA-Z0-9_]+)/', $this->url, $matched);
$thumbnail = isset($matched[1]) ? 'https://img.youtube.com/vi/' . $matched[1] . '/mqdefault.jpg' : null;
}