[VkBridge] More beatifications and fixes (#712)

* Add one more selector for article_author_selector
* Extend video parsing
* Add poll parsing
This commit is contained in:
Eugene Molotov 2018-06-11 01:09:50 +05:00 committed by LogMANOriginal
parent d92da8f0f7
commit 7dc09db9ca
1 changed files with 22 additions and 1 deletions

View File

@ -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 .= "<br>Video: <a href='$video_link'>$video_title</a>";
$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 .= "<br>Poll: $poll_title";
foreach($div->find('div.page_poll_text') as $poll_stat_title) {
$content_suffix .= "<br>- " . $poll_stat_title->innertext;
}
$div->outertext = '';
}
// get sign
$post_author = $pageName;
foreach($post->find('a.wall_signed_by') as $a) {