Skip to content

Commit

Permalink
[MixologyBridge] add null checks for author and timestamp elements (#…
Browse files Browse the repository at this point in the history
…4383)

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

* [MixologyBridge] fix formatting
  • Loading branch information
swofl authored Jan 3, 2025
1 parent e825272 commit 45ee018
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bridges/MixologyBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ protected function parseItem(array $item)
{
$article = getSimpleHTMLDOMCached($item['uri']);

$item['author'] = $article->find('.beitrag-author a', 0)->plaintext;
$item['timestamp'] = strtotime($article->find('.beitrag-date time', 0)->datetime);
$authorLink = $article->find('.beitrag-author a', 0);
if (!empty($authorLink)) {
$item['author'] = $authorLink->plaintext;
}

$timeElement = $article->find('.beitrag-date time', 0);
if (!empty($timeElement)) {
$item['timestamp'] = strtotime($timeElement->datetime);
}

$content = '';

Expand Down

0 comments on commit 45ee018

Please sign in to comment.