mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-09 16:38:50 +00:00
[VkBridge] Add video thumbnails (#3206)
This commit is contained in:
parent
b58f2ed338
commit
eab82f0a26
@ -141,24 +141,15 @@ class VkBridge extends BridgeAbstract
|
|||||||
$article->outertext = '';
|
$article->outertext = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// get video on post
|
// get all videos
|
||||||
$video = $post->find('div.post_video_desc', 0);
|
|
||||||
$main_video_link = '';
|
|
||||||
if (is_object($video)) {
|
|
||||||
$video_title = $video->find('div.post_video_title', 0)->plaintext;
|
|
||||||
$video_link = $video->find('a.lnk', 0)->getAttribute('href');
|
|
||||||
$this->appendVideo($video_title, $video_link, $content_suffix);
|
|
||||||
$video->outertext = '';
|
|
||||||
$main_video_link = $video_link;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get all other videos
|
|
||||||
foreach ($post->find('a.page_post_thumb_video') as $a) {
|
foreach ($post->find('a.page_post_thumb_video') as $a) {
|
||||||
$video_title = htmlspecialchars_decode($a->getAttribute('aria-label'));
|
$video_title = htmlspecialchars_decode($a->getAttribute('aria-label'));
|
||||||
$video_link = $a->getAttribute('href');
|
$video_title_split_pos = strrpos($video_title, ' is ');
|
||||||
if ($video_link != $main_video_link) {
|
if ($video_title_split_pos !== false) {
|
||||||
$this->appendVideo($video_title, $video_link, $content_suffix);
|
$video_title = substr($video_title, 0, $video_title_split_pos);
|
||||||
}
|
}
|
||||||
|
$video_link = $a->getAttribute('href');
|
||||||
|
$this->appendVideo($video_title, $video_link, backgroundToImg($a), $content_suffix);
|
||||||
$a->outertext = '';
|
$a->outertext = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,12 +450,13 @@ class VkBridge extends BridgeAbstract
|
|||||||
returnServerError('Too many redirects, while retreving content from VK');
|
returnServerError('Too many redirects, while retreving content from VK');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function appendVideo($video_title, $video_link, &$content_suffix)
|
protected function appendVideo($video_title, $video_link, $previewImg, &$content_suffix)
|
||||||
{
|
{
|
||||||
if (!$video_title) {
|
if (!$video_title) {
|
||||||
$video_title = '(empty)';
|
$video_title = '(empty)';
|
||||||
}
|
}
|
||||||
|
|
||||||
$content_suffix .= '<br>Video: <a href="' . htmlspecialchars($video_link) . '">' . $video_title . '</a>';
|
$content_suffix .= '<br><a href="' . htmlspecialchars($video_link) . '">' . $previewImg;
|
||||||
|
$content_suffix .= 'Video: ' . $video_title . '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user