[mod] qwant engine: fix typos / minor change

minor modification of commit 628b5703f3
(no functionnal change)
This commit is contained in:
Alexandre Flament 2021-07-16 15:32:12 +02:00
parent 628b5703f3
commit 0d65a81b1c

View file

@ -31,12 +31,10 @@ from json import loads
from urllib.parse import urlencode from urllib.parse import urlencode
from flask_babel import gettext from flask_babel import gettext
# from searx import logger
from searx.utils import match_language from searx.utils import match_language
from searx.exceptions import SearxEngineAPIException from searx.exceptions import SearxEngineAPIException
from searx.network import raise_for_httperror from searx.network import raise_for_httperror
#logger = logger.getChild('qwant')
# about # about
about = { about = {
@ -182,19 +180,18 @@ def response(resp):
}) })
elif mainline_type == 'videos': elif mainline_type == 'videos':
# some videos do not have a description: while quant-video # some videos do not have a description: while qwant-video
# returns an empty string, such video from a quant-web query # returns an empty string, such video from a qwant-web query
# miss the 'desc' key. # miss the 'desc' key.
content = item.get('desc', '') d, s, c = item.get('desc'), item.get('source'), item.get('channel')
s, c = item.get('source',''), item.get('channel','') content_parts = []
if content and (s or c): if d:
content += " // " content_parts.append(d)
if s: if s:
content += "%s: %s " % (gettext("Source"), s) content_parts.append("%s: %s " % (gettext("Source"), s))
if c: if c:
content += "//" content_parts.append("%s: %s " % (gettext("Channel"), c))
if c: content = ' // '.join(content_parts)
content += " %s: %s " % (gettext("Channel"), c)
length = timedelta(seconds=item['duration']) length = timedelta(seconds=item['duration'])
pub_date = datetime.fromtimestamp(item['date']) pub_date = datetime.fromtimestamp(item['date'])
thumbnail = item['thumbnail'] thumbnail = item['thumbnail']