[ZeitBridge] Prettify author field

By removing HTML tags (plaintext) and trimming it.
This commit is contained in:
Mynacol 2024-05-18 15:46:53 +02:00
parent b785a4b64e
commit a7ed3d56f9

View file

@ -108,12 +108,9 @@ class ZeitBridge extends FeedExpander
}
// authors
$authors = $article->find('*[itemtype*="schema.org/Person"]');
if (!$authors) {
$authors = $article->find('.metadata__source');
}
$authors = $article->find('*[itemtype*="schema.org/Person"]') ?? $article->find('.metadata__source');
if ($authors) {
$item['author'] = implode(', ', $authors);
$item['author'] = implode(', ', array_map(function ($e) { return trim($e->plaintext); }, $authors));
}
// header image