Skip to content

Commit

Permalink
[PikabuBridge] Marking posts from "Как бы Новости" section, which are…
Browse files Browse the repository at this point in the history
… funny and deliberately fake (#2032)
  • Loading branch information
em92 authored Mar 30, 2021
1 parent 40c84b5 commit 0c8fabe
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions bridges/PikabuBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,25 @@ public function collectData(){
}
}

$title = $post->find('.story__title-link', 0);
$title_element = $post->find('.story__title-link', 0);

$title = $title_element->plaintext;
$community_link = $post->find('.story__community-link', 0);
// adding special marker for "Maybe News" section
// these posts are fake
if (!is_null($community_link) && $community_link->getAttribute('href') == '/community/maybenews') {
$title = '[' . $community_link->innertext . '] ' . $title;
}

$item = array();
$item['categories'] = $categories;
$item['author'] = $post->find('.user__nick', 0)->innertext;
$item['title'] = $title->plaintext;
$item['title'] = $title;
$item['content'] = strip_tags(
backgroundToImg($post->find('.story__content-inner', 0)->innertext),
'<br><p><img><a>
');
$item['uri'] = $title->href;
$item['uri'] = $title_element->href;
$item['timestamp'] = strtotime($time->getAttribute('datetime'));
$this->items[] = $item;
}
Expand Down

0 comments on commit 0c8fabe

Please sign in to comment.