mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-22 17:45:40 +03:00
fix(rumble): not all videos have a datetime (#3852)
This commit is contained in:
parent
a81acbe464
commit
4c5cf89725
1 changed files with 7 additions and 4 deletions
|
@ -40,15 +40,18 @@ class RumbleBridge extends BridgeAbstract
|
||||||
|
|
||||||
$dom = getSimpleHTMLDOM($url);
|
$dom = getSimpleHTMLDOM($url);
|
||||||
foreach ($dom->find('ol.thumbnail__grid div.thumbnail__grid--item') as $video) {
|
foreach ($dom->find('ol.thumbnail__grid div.thumbnail__grid--item') as $video) {
|
||||||
$datetime = $video->find('time', 0)->getAttribute('datetime');
|
$item = [
|
||||||
|
|
||||||
$this->items[] = [
|
|
||||||
'title' => $video->find('h3', 0)->plaintext,
|
'title' => $video->find('h3', 0)->plaintext,
|
||||||
'uri' => self::URI . $video->find('a', 0)->href,
|
'uri' => self::URI . $video->find('a', 0)->href,
|
||||||
'timestamp' => (new \DateTimeImmutable($datetime))->getTimestamp(),
|
|
||||||
'author' => $account . '@rumble.com',
|
'author' => $account . '@rumble.com',
|
||||||
'content' => defaultLinkTo($video, self::URI)->innertext,
|
'content' => defaultLinkTo($video, self::URI)->innertext,
|
||||||
];
|
];
|
||||||
|
$time = $video->find('time', 0);
|
||||||
|
if ($time) {
|
||||||
|
$publishedAt = new \DateTimeImmutable($time->getAttribute('datetime'));
|
||||||
|
$item['timestamp'] = $publishedAt->getTimestamp();
|
||||||
|
}
|
||||||
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue