mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Google: Configurable base URL. Closes GH-64.
This commit is contained in:
parent
efcf9d7837
commit
a15dea55db
@ -101,6 +101,9 @@ conf.registerGlobalValue(Google, 'referer',
|
|||||||
the Referer field of the search requests. If this value is empty, a
|
the Referer field of the search requests. If this value is empty, a
|
||||||
Referer will be generated in the following format:
|
Referer will be generated in the following format:
|
||||||
http://$server/$botName""")))
|
http://$server/$botName""")))
|
||||||
|
conf.registerChannelValue(Google, 'baseUrl',
|
||||||
|
registry.String('google.com', _("""Determines the base URL used for
|
||||||
|
requests.""")))
|
||||||
conf.registerChannelValue(Google, 'searchSnarfer',
|
conf.registerChannelValue(Google, 'searchSnarfer',
|
||||||
registry.Boolean(False, _("""Determines whether the search snarfer is
|
registry.Boolean(False, _("""Determines whether the search snarfer is
|
||||||
enabled. If so, messages (even unaddressed ones) beginning with the word
|
enabled. If so, messages (even unaddressed ones) beginning with the word
|
||||||
|
@ -290,13 +290,15 @@ class Google(callbacks.PluginRegexp):
|
|||||||
def _googleUrl(self, s):
|
def _googleUrl(self, s):
|
||||||
s = s.replace('+', '%2B')
|
s = s.replace('+', '%2B')
|
||||||
s = s.replace(' ', '+')
|
s = s.replace(' ', '+')
|
||||||
url = r'http://google.com/search?q=' + s
|
url = r'http://%s/search?q=%s' % \
|
||||||
|
(self.registryValue('baseUrl', channel), s)
|
||||||
return url
|
return url
|
||||||
|
|
||||||
def _googleUrlIG(self, s):
|
def _googleUrlIG(self, s):
|
||||||
s = s.replace('+', '%2B')
|
s = s.replace('+', '%2B')
|
||||||
s = s.replace(' ', '+')
|
s = s.replace(' ', '+')
|
||||||
url = r'http://www.google.com/ig/calculator?hl=en&q=' + s
|
url = r'http://%s/ig/calculator?hl=en&q=%s' % \
|
||||||
|
(self.registryValue('baseUrl', channel), s)
|
||||||
return url
|
return url
|
||||||
|
|
||||||
_calcRe1 = re.compile(r'<table.*class="?obcontainer"?[^>]*>(.*?)</table>', re.I)
|
_calcRe1 = re.compile(r'<table.*class="?obcontainer"?[^>]*>(.*?)</table>', re.I)
|
||||||
|
Loading…
Reference in New Issue
Block a user