From 0e9cfe22d00999741ed389ccbe6f5306a58c03e7 Mon Sep 17 00:00:00 2001 From: triatic <42704418+triatic@users.noreply.github.com> Date: Mon, 1 Jul 2019 15:47:25 +0100 Subject: [PATCH] [TelegramBridge] Fix for forwarded videos Videos forwarded from other channels use a slightly different format, This fixes it. --- bridges/TelegramBridge.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bridges/TelegramBridge.php b/bridges/TelegramBridge.php index 45a5fafb988..7703fd46638 100644 --- a/bridges/TelegramBridge.php +++ b/bridges/TelegramBridge.php @@ -224,7 +224,11 @@ private function processVideo($messageDiv) { $this->itemTitle = '@' . $this->processUsername() . ' posted a video'; } - preg_match($this->backgroundImageRegex, $messageDiv->find('i.tgme_widget_message_video_thumb', 0)->style, $photo); + if ($messageDiv->find('i.tgme_widget_message_video_thumb')) { + preg_match($this->backgroundImageRegex, $messageDiv->find('i.tgme_widget_message_video_thumb', 0)->style, $photo); + } elseif ($messageDiv->find('i.link_preview_video_thumb')) { + preg_match($this->backgroundImageRegex, $messageDiv->find('i.link_preview_video_thumb', 0)->style, $photo); + } $this->enclosures[] = $photo[1]; @@ -261,7 +265,11 @@ private function processNotSupported($messageDiv) { $this->itemTitle = '@' . $this->processUsername() . ' posted a video'; } - preg_match($this->backgroundImageRegex, $messageDiv->find('i.tgme_widget_message_video_thumb', 0)->style, $photo); + if ($messageDiv->find('i.tgme_widget_message_video_thumb')) { + preg_match($this->backgroundImageRegex, $messageDiv->find('i.tgme_widget_message_video_thumb', 0)->style, $photo); + } elseif ($messageDiv->find('i.link_preview_video_thumb')) { + preg_match($this->backgroundImageRegex, $messageDiv->find('i.link_preview_video_thumb', 0)->style, $photo); + } $this->enclosures[] = $photo[1];