mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-25 19:44:13 +01:00
Fixed bug #802826, --safe wouldn't work.
This commit is contained in:
parent
671648368a
commit
9bca5d98f7
@ -148,16 +148,22 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
googlelicensekey = privmsgs.checkCapability(googlelicensekey, 'admin')
|
googlelicensekey = privmsgs.checkCapability(googlelicensekey, 'admin')
|
||||||
|
|
||||||
def google(self, irc, msg, args):
|
def google(self, irc, msg, args):
|
||||||
"""<search string> [--{language,restrict,safe,filter}=<value>]
|
"""<search string> [--{language,restrict}=<value>] [--{safe,similar}]
|
||||||
|
|
||||||
Searches google.com for the given string. As many results as can fit
|
Searches google.com for the given string. As many results as can fit
|
||||||
are included. Use options to set different values for the options
|
are included. --language accepts a language abbreviation; --restrict
|
||||||
Google accepts.
|
restricts the results to certain classes of things; --similar tells
|
||||||
|
Google not to filter similar results.
|
||||||
"""
|
"""
|
||||||
(optlist, rest) = getopt.getopt(args, '', ['language=', 'restrict=',
|
(optlist, rest) = getopt.getopt(args, '', ['language=', 'restrict=',
|
||||||
'safe=', 'filter='])
|
'safe', 'similar'])
|
||||||
kwargs = {'language': 'lang_en', 'safeSearch': 1}
|
kwargs = {'language': 'lang_en', 'safeSearch': 1}
|
||||||
for (option, argument) in optlist:
|
for (option, argument) in optlist:
|
||||||
|
if option == '--safe':
|
||||||
|
kwargs['safeSearch'] = True
|
||||||
|
elif option == '--similar':
|
||||||
|
kwargs['filter'] = False
|
||||||
|
else:
|
||||||
kwargs[option[2:]] = argument
|
kwargs[option[2:]] = argument
|
||||||
searchString = privmsgs.getArgs(rest)
|
searchString = privmsgs.getArgs(rest)
|
||||||
data = search(searchString, **kwargs)
|
data = search(searchString, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user