Use wikidata description as fallback if wikipedia description is not
parsable in Wikidata fetcher Close #16
This commit is contained in:
parent
12a7937218
commit
835da05c38
|
@ -648,16 +648,23 @@ final class NodaWikidataFetcher {
|
||||||
$tDescription = "";
|
$tDescription = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tDescription !== '') {
|
if ($tDescription !== '' && !empty($desc_cleaned = self::_cleanWikidataInput($tDescription))) {
|
||||||
# $descs[$lang] = $tDescription;
|
# $descs[$lang] = $tDescription;
|
||||||
$desc_cleaned = self::_cleanWikidataInput($tDescription);
|
$output[$lang] = [
|
||||||
if ($desc_cleaned !== '') {
|
'label' => self::_cleanWikidataInput((string)$data['labels'][$lang]['value']),
|
||||||
$output[$lang] = [
|
'description' => '"' . $desc_cleaned . '" - (' . $data['labels'][$lang]['language'] . '.wikipedia.org ' . date('d.m.Y') . ')',
|
||||||
'label' => self::_cleanWikidataInput((string)$data['labels'][$lang]['value']),
|
'link' => $wikilink,
|
||||||
'description' => '"' . $desc_cleaned . '" - (' . $data['labels'][$lang]['language'] . '.wikipedia.org ' . date('d.m.Y') . ')',
|
];
|
||||||
'link' => $wikilink,
|
}
|
||||||
];
|
// Fallback: Use Wikidata description
|
||||||
}
|
else if (!empty($data['labels'][$lang]['value']) and !empty($data['descriptions'][$lang])) {
|
||||||
|
|
||||||
|
$output[$lang] = [
|
||||||
|
'label' => self::_cleanWikidataInput($data['labels'][$lang]['value']),
|
||||||
|
'description' => self::_cleanWikidataInput($data['descriptions'][$lang]['value']),
|
||||||
|
'link' => "",
|
||||||
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user