forked from zaclys/searxng
[fix] springer: unsupported operand type(s) for +: 'NoneType' and 'str'
- fix issue reported #1809 - filter out `None` value from issn and isbn list - add comments (from publicationName) - add publisher Closes: https://github.com/searxng/searxng/issues/1809 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
94c4cc126b
commit
0052887929
|
@ -41,7 +41,6 @@ def response(resp):
|
||||||
json_data = loads(resp.text)
|
json_data = loads(resp.text)
|
||||||
|
|
||||||
for record in json_data['records']:
|
for record in json_data['records']:
|
||||||
content = record['abstract']
|
|
||||||
published = datetime.strptime(record['publicationDate'], '%Y-%m-%d')
|
published = datetime.strptime(record['publicationDate'], '%Y-%m-%d')
|
||||||
authors = [" ".join(author['creator'].split(', ')[::-1]) for author in record['creators']]
|
authors = [" ".join(author['creator'].split(', ')[::-1]) for author in record['creators']]
|
||||||
tags = record.get('genre')
|
tags = record.get('genre')
|
||||||
|
@ -50,20 +49,24 @@ def response(resp):
|
||||||
results.append(
|
results.append(
|
||||||
{
|
{
|
||||||
'template': 'paper.html',
|
'template': 'paper.html',
|
||||||
'title': record['title'],
|
|
||||||
'url': record['url'][0]['value'].replace('http://', 'https://', 1),
|
'url': record['url'][0]['value'].replace('http://', 'https://', 1),
|
||||||
'type': record.get('contentType'),
|
'title': record['title'],
|
||||||
'content': content,
|
'content': record['abstract'],
|
||||||
'publishedDate': published,
|
'comments': record['publicationName'],
|
||||||
'authors': authors,
|
|
||||||
'doi': record.get('doi'),
|
|
||||||
'journal': record.get('publicationName'),
|
|
||||||
'pages': record.get('start_page') + '-' + record.get('end_page'),
|
|
||||||
'tags': tags,
|
'tags': tags,
|
||||||
'issn': [record.get('issn')],
|
'publishedDate': published,
|
||||||
'isbn': [record.get('isbn')],
|
'type': record.get('contentType'),
|
||||||
|
'authors': authors,
|
||||||
|
# 'editor': '',
|
||||||
|
'publisher': record.get('publisher'),
|
||||||
|
'journal': record.get('publicationName'),
|
||||||
'volume': record.get('volume') or None,
|
'volume': record.get('volume') or None,
|
||||||
|
'pages': '-'.join([x for x in [record.get('startingPage'), record.get('endingPage')] if x]),
|
||||||
'number': record.get('number') or None,
|
'number': record.get('number') or None,
|
||||||
|
'doi': record.get('doi'),
|
||||||
|
'issn': [x for x in [record.get('issn')] if x],
|
||||||
|
'isbn': [x for x in [record.get('isbn')] if x],
|
||||||
|
# 'pdf_url' : ''
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return results
|
return results
|
||||||
|
|
Loading…
Reference in New Issue