mirror of https://github.com/searxng/searxng.git
[pylint] Bing (Videos) engine
Fix remarks from pylint and remove obsolete try/except block Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
c6922ae7c5
commit
6d7a38a912
|
@ -1,12 +1,14 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
"""
|
# lint: pylint
|
||||||
Bing (Videos)
|
"""Bing (Videos)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from json import loads
|
from json import loads
|
||||||
from lxml import html
|
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
|
from lxml import html
|
||||||
|
|
||||||
from searx.utils import match_language
|
from searx.utils import match_language
|
||||||
from searx.engines.bing import language_aliases
|
from searx.engines.bing import language_aliases
|
||||||
|
|
||||||
|
@ -82,7 +84,6 @@ def response(resp):
|
||||||
dom = html.fromstring(resp.text)
|
dom = html.fromstring(resp.text)
|
||||||
|
|
||||||
for result in dom.xpath('//div[@class="dg_u"]'):
|
for result in dom.xpath('//div[@class="dg_u"]'):
|
||||||
try:
|
|
||||||
metadata = loads(result.xpath('.//div[@class="vrhdata"]/@vrhm')[0])
|
metadata = loads(result.xpath('.//div[@class="vrhdata"]/@vrhm')[0])
|
||||||
info = ' - '.join(result.xpath('.//div[@class="mc_vtvc_meta_block"]//span/text()')).strip()
|
info = ' - '.join(result.xpath('.//div[@class="mc_vtvc_meta_block"]//span/text()')).strip()
|
||||||
content = '{0} - {1}'.format(metadata['du'], info)
|
content = '{0} - {1}'.format(metadata['du'], info)
|
||||||
|
@ -97,7 +98,4 @@ def response(resp):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
except:
|
|
||||||
continue
|
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
Loading…
Reference in New Issue