From dd55732a15e2a84e421dda072f81f3c0037c7137 Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Tue, 20 Mar 2018 11:47:43 +0500 Subject: [PATCH] [VkBridge] Added video parsing --- bridges/VkBridge.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bridges/VkBridge.php b/bridges/VkBridge.php index a4c2e169..5a408e2a 100644 --- a/bridges/VkBridge.php +++ b/bridges/VkBridge.php @@ -101,6 +101,15 @@ class VkBridge extends BridgeAbstract $article->outertext = ''; } + // get video on post + $video = $post->find('div.post_video_desc', 0); + if (is_object($video)) { + $video_title = $video->find('div.post_video_title', 0)->plaintext; + $video_link = self::URI . ltrim( $video->find('a.lnk', 0)->getAttribute('href'), '/' ); + $content_suffix .= "
Video: $video_title"; + $video->outertext = ''; + } + if (is_object($post->find('div.copy_quote', 0))) { $copy_quote = $post->find('div.copy_quote', 0); if ($copy_post_header = $copy_quote->find('div.copy_post_header', 0)) { @@ -113,13 +122,6 @@ class VkBridge extends BridgeAbstract $item = array(); $item['content'] = strip_tags(backgroundToImg($post->find('div.wall_text', 0)->innertext), '
') . $content_suffix; - //get video on post - if (is_object($post->find('span.post_video_title_content', 0))) { - $titleVideo = $post->find('span.post_video_title_content', 0)->plaintext; - $linkToVideo = self::URI . $post->find('a.page_post_thumb_video', 0)->getAttribute('href'); - $item['content'] .= "\n\r {$titleVideo}: {$linkToVideo}"; - } - // get post link $post_link = $post->find('a.post_link', 0)->getAttribute('href'); preg_match("/wall-?\d+_(\d+)/", $post_link, $preg_match_result);