mirror of
http://aero2k.de/t/repos/urlbot-native.git
synced 2017-09-06 15:25:38 +02:00
return search url for bangs if no direct result is available
This commit is contained in:
@@ -757,6 +757,8 @@ def search_the_web(argv, **args):
|
||||
response = requests.get(url, params=params).json()
|
||||
link = response.get('AbstractURL')
|
||||
abstract = response.get('Abstract')
|
||||
redirect = response.get('Redirect')
|
||||
|
||||
if len(abstract) > 150:
|
||||
suffix = '…'
|
||||
else:
|
||||
@@ -766,6 +768,10 @@ def search_the_web(argv, **args):
|
||||
return {
|
||||
'msg': '{}{} ({})'.format(abstract[:150], suffix, link)
|
||||
}
|
||||
elif redirect:
|
||||
return {
|
||||
'msg': 'No direct result found, use {}'.format(redirect)
|
||||
}
|
||||
|
||||
|
||||
@pluginfunction('raise', 'only for debugging', ptypes_COMMAND)
|
||||
|
||||
Reference in New Issue
Block a user