From 7dc09db9ca52c10257f906e518cf7d306ad86b63 Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Mon, 11 Jun 2018 01:09:50 +0500 Subject: [PATCH] [VkBridge] More beatifications and fixes (#712) * Add one more selector for article_author_selector * Extend video parsing * Add poll parsing --- bridges/VkBridge.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/bridges/VkBridge.php b/bridges/VkBridge.php index d29c75e..0110754 100644 --- a/bridges/VkBridge.php +++ b/bridges/VkBridge.php @@ -104,7 +104,8 @@ class VkBridge extends BridgeAbstract if (is_object($article)) { if (strpos($article->getAttribute('class'), "article_snippet_mini") !== false) { $article_title_selector = "div.article_snippet_mini_title"; - $article_author_selector = "div.article_snippet_mini_info > .group_link"; + $article_author_selector = "div.article_snippet_mini_info > .mem_link, + div.article_snippet_mini_info > .group_link"; $article_thumb_selector = "div.article_snippet_mini_thumb"; } else { $article_title_selector = "div.article_snippet__title"; @@ -132,6 +133,16 @@ class VkBridge extends BridgeAbstract $video->outertext = ''; } + // get all other videos + foreach($post->find('a.page_post_thumb_video') as $a) { + $video_title = $a->getAttribute('aria-label'); + $temp = explode(" ", $video_title, 2); + if (count($temp) > 1) $video_title = $temp[1]; + $video_link = self::URI . ltrim( $a->getAttribute('href'), '/' ); + $content_suffix .= "
Video: $video_title"; + $a->outertext = ''; + } + // get all photos foreach($post->find('div.wall_text > a.page_post_thumb_wrap') as $a) { $result = $this->getPhoto($a); @@ -188,6 +199,16 @@ class VkBridge extends BridgeAbstract $div->outertext = ''; } + // get polls + foreach($post->find('div.page_media_poll_wrap') as $div) { + $poll_title = $div->find('.page_media_poll_title', 0)->innertext; + $content_suffix .= "
Poll: $poll_title"; + foreach($div->find('div.page_poll_text') as $poll_stat_title) { + $content_suffix .= "
- " . $poll_stat_title->innertext; + } + $div->outertext = ''; + } + // get sign $post_author = $pageName; foreach($post->find('a.wall_signed_by') as $a) {