fix(rumble): not all videos have a datetime (#3852)

This commit is contained in:
Dag 2023-12-21 09:18:21 +01:00 committed by GitHub
parent a81acbe464
commit 4c5cf89725
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -40,15 +40,18 @@ class RumbleBridge extends BridgeAbstract
$dom = getSimpleHTMLDOM($url);
foreach ($dom->find('ol.thumbnail__grid div.thumbnail__grid--item') as $video) {
$datetime = $video->find('time', 0)->getAttribute('datetime');
$this->items[] = [
$item = [
'title' => $video->find('h3', 0)->plaintext,
'uri' => self::URI . $video->find('a', 0)->href,
'timestamp' => (new \DateTimeImmutable($datetime))->getTimestamp(),
'author' => $account . '@rumble.com',
'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;
}
}