mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-23 15:06:53 +00:00
[VkBridge] Generate feed item title
This commit is contained in:
parent
d583b0c974
commit
ca77295c80
@ -73,12 +73,20 @@ class VkBridge extends BridgeAbstract
|
|||||||
// get post link
|
// get post link
|
||||||
$item['uri'] = self::URI . $post->find('a.post_link', 0)->getAttribute('href');
|
$item['uri'] = self::URI . $post->find('a.post_link', 0)->getAttribute('href');
|
||||||
$item['timestamp'] = $this->getTime($post);
|
$item['timestamp'] = $this->getTime($post);
|
||||||
|
$item['title'] = $this->getTitle($item['content']);
|
||||||
$item['author'] = $pageName;
|
$item['author'] = $pageName;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getTitle($content)
|
||||||
|
{
|
||||||
|
preg_match('/^["\w\ \p{Cyrillic}\(\)\?#«»-]+/mu', htmlspecialchars_decode($content), $result);
|
||||||
|
if (count($result) == 0) return "untitled";
|
||||||
|
return $result[0];
|
||||||
|
}
|
||||||
|
|
||||||
private function getTime($post)
|
private function getTime($post)
|
||||||
{
|
{
|
||||||
if ($time = $post->find('span.rel_date', 0)->getAttribute('time')) {
|
if ($time = $post->find('span.rel_date', 0)->getAttribute('time')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user