[MixologyBridge] add null checks for author and timestamp elements (#4383)

* [MixologyBridge] add null checks for author and timestamp elements

* [MixologyBridge] fix formatting
This commit is contained in:
Sebastian Wolf 2025-01-03 01:43:39 +01:00 committed by GitHub
parent e825272987
commit 45ee018a6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,8 +55,15 @@ class MixologyBridge extends BridgeAbstract
{ {
$article = getSimpleHTMLDOMCached($item['uri']); $article = getSimpleHTMLDOMCached($item['uri']);
$item['author'] = $article->find('.beitrag-author a', 0)->plaintext; $authorLink = $article->find('.beitrag-author a', 0);
$item['timestamp'] = strtotime($article->find('.beitrag-date time', 0)->datetime); if (!empty($authorLink)) {
$item['author'] = $authorLink->plaintext;
}
$timeElement = $article->find('.beitrag-date time', 0);
if (!empty($timeElement)) {
$item['timestamp'] = strtotime($timeElement->datetime);
}
$content = ''; $content = '';