mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-26 03:16:33 +03:00
[TelegramBridge] Fix entries for "media too big" (#1184)
When a large video is posted, "Media is too big" appears in web preview. This adds code to detect this and offer a link.
This commit is contained in:
parent
89e3da0b6f
commit
3769850ba3
1 changed files with 22 additions and 0 deletions
|
@ -108,6 +108,10 @@ class TelegramBridge extends BridgeAbstract {
|
|||
$message .= $this->processPhoto($messageDiv);
|
||||
}
|
||||
|
||||
if ($messageDiv->find('a.not_supported', 0)) {
|
||||
$message .= $this->processNotSupported($messageDiv);
|
||||
}
|
||||
|
||||
if ($messageDiv->find('div.tgme_widget_message_text.js-message_text', 0)) {
|
||||
$message .= $messageDiv->find('div.tgme_widget_message_text.js-message_text', 0);
|
||||
|
||||
|
@ -250,6 +254,24 @@ EOD;
|
|||
return $photos;
|
||||
}
|
||||
|
||||
private function processNotSupported($messageDiv) {
|
||||
|
||||
if (empty($this->itemTitle)) {
|
||||
$this->itemTitle = '@' . $this->processUsername() . ' posted a video';
|
||||
}
|
||||
|
||||
preg_match($this->backgroundImageRegex, $messageDiv->find('i.tgme_widget_message_video_thumb', 0)->style, $photo);
|
||||
|
||||
$this->enclosures[] = $photo[1];
|
||||
|
||||
return <<<EOD
|
||||
<a href="{$messageDiv->find('a.not_supported', 0)->href}">
|
||||
{$messageDiv->find('div.message_media_not_supported_label', 0)->innertext}<br><br>
|
||||
{$messageDiv->find('span.message_media_view_in_telegram', 0)->innertext}<br><br>
|
||||
<img src="{$photo[1]}"/></a>
|
||||
EOD;
|
||||
}
|
||||
|
||||
private function processDate($messageDiv) {
|
||||
|
||||
$messageMeta = $messageDiv->find('span.tgme_widget_message_meta', 0);
|
||||
|
|
Loading…
Reference in a new issue