Skip to content

Commit

Permalink
[TelegramBridge] Fix forwarded videos (#1202)
Browse files Browse the repository at this point in the history
Videos forwarded from other channels use a slightly different format, This fixes it.
  • Loading branch information
triatic authored and logmanoriginal committed Jul 6, 2019
1 parent 50162f5 commit a31e518
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bridges/TelegramBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down Expand Up @@ -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];

Expand Down

0 comments on commit a31e518

Please sign in to comment.