Skip to content

Commit 9b3e083

Browse files
committed
[EuronewsBridge] Fix author extraction
For original articles. Articles provided by other partners don't have the correct author info. But this also won't throw an error anymore.
1 parent 7aac043 commit 9b3e083

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bridges/EuronewsBridge.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ private function getItemContent($url)
102102
foreach ($json['@graph'] as $item) {
103103
if ($item['@type'] == 'NewsArticle') {
104104
if (array_key_exists('author', $item)) {
105-
$author = $item['author']['name'];
105+
if (is_array($item['author'])) {
106+
$author = implode(', ', array_map(function ($e) {
107+
return $e['name'];
108+
}, $item['author']));
109+
} elseif (array_key_exists('name', $item['author'])) {
110+
$author = $item['author']['name'];
111+
}
106112
}
107113
if (array_key_exists('image', $item)) {
108114
$content .= '<figure>';

0 commit comments

Comments
 (0)