summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2022-09-25 14:57:02 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2022-09-25 15:25:55 +0200
commit00528879294358d46a47ab3eee329c5a52fb1284 (patch)
tree9ab6247822ace2f4855c545b1168276a7e6a7f19 /searx/engines
parent94c4cc126b16d4cd1653c410df63af4bc0a4e998 (diff)
downloadsearxng-00528879294358d46a47ab3eee329c5a52fb1284.tar.gz
searxng-00528879294358d46a47ab3eee329c5a52fb1284.zip
[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>
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/springer.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/searx/engines/springer.py b/searx/engines/springer.py
index e5255b794..a4d0832d8 100644
--- a/searx/engines/springer.py
+++ b/searx/engines/springer.py
@@ -41,7 +41,6 @@ def response(resp):
json_data = loads(resp.text)
for record in json_data['records']:
- content = record['abstract']
published = datetime.strptime(record['publicationDate'], '%Y-%m-%d')
authors = [" ".join(author['creator'].split(', ')[::-1]) for author in record['creators']]
tags = record.get('genre')
@@ -50,20 +49,24 @@ def response(resp):
results.append(
{
'template': 'paper.html',
- 'title': record['title'],
'url': record['url'][0]['value'].replace('http://', 'https://', 1),
- 'type': record.get('contentType'),
- 'content': content,
+ 'title': record['title'],
+ 'content': record['abstract'],
+ 'comments': record['publicationName'],
+ 'tags': tags,
'publishedDate': published,
+ 'type': record.get('contentType'),
'authors': authors,
- 'doi': record.get('doi'),
+ # 'editor': '',
+ 'publisher': record.get('publisher'),
'journal': record.get('publicationName'),
- 'pages': record.get('start_page') + '-' + record.get('end_page'),
- 'tags': tags,
- 'issn': [record.get('issn')],
- 'isbn': [record.get('isbn')],
'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,
+ '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