diff options
author | Adam Tauber <asciimoo@gmail.com> | 2017-12-01 20:46:28 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2017-12-01 20:54:12 +0100 |
commit | 801b5a56ad93065b4a5e69652cf97aadc874ef57 (patch) | |
tree | 797f250118d4962eb7c0e7f086527050aec5b2b5 /searx/engines | |
parent | 0969e50c5bc949d2c15eaed8e6a7def6b9da00fa (diff) | |
download | searxng-801b5a56ad93065b4a5e69652cf97aadc874ef57.tar.gz searxng-801b5a56ad93065b4a5e69652cf97aadc874ef57.zip |
[fix] multiple fixes in pdbe engine
Diffstat (limited to 'searx/engines')
-rw-r--r-- | searx/engines/pdbe.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/searx/engines/pdbe.py b/searx/engines/pdbe.py index f784e106f..2db92868a 100644 --- a/searx/engines/pdbe.py +++ b/searx/engines/pdbe.py @@ -43,7 +43,7 @@ def construct_body(result): title = result['title'] # construct content body - content = """{title}<br />{authors} {journal} <strong>{volume}</strong> {page} ({year})""" + content = """{title} - {authors} {journal} ({volume}) {page} ({year})""" # replace placeholders with actual content try: @@ -84,15 +84,18 @@ def response(resp): continue if result['status'] == 'OBS': # expand title to add some sort of warning message - title = gettext('{title} (OBSOLETE)').format(title=result['title']) - superseded_url = pdbe_entry_url.format(pdb_id=result['superseded_by']) + title = gettext('{title} (OBSOLETE)').format(title=result['title']) + try: + superseded_url = pdbe_entry_url.format(pdb_id=result['superseded_by']) + except: + continue # since we can't construct a proper body from the response, we'll make up our own msg_superseded = gettext("This entry has been superseded by") - content = '<em>{msg_superseded} \<a href="{url}">{pdb_id}</a></em>'.format( + content = '{msg_superseded}: {url} ({pdb_id})'.format( msg_superseded=msg_superseded, url=superseded_url, - pdb_id=result['superseded_by'], ) + pdb_id=result['superseded_by']) # obsoleted entries don't have preview images img_src = None |