diff --git a/plugins/Google/config.py b/plugins/Google/config.py index 215ba1c00..8aa40bd58 100644 --- a/plugins/Google/config.py +++ b/plugins/Google/config.py @@ -101,6 +101,9 @@ conf.registerGlobalValue(Google, 'referer', the Referer field of the search requests. If this value is empty, a Referer will be generated in the following format: http://$server/$botName"""))) +conf.registerChannelValue(Google, 'baseUrl', + registry.String('google.com', _("""Determines the base URL used for + requests."""))) conf.registerChannelValue(Google, 'searchSnarfer', registry.Boolean(False, _("""Determines whether the search snarfer is enabled. If so, messages (even unaddressed ones) beginning with the word diff --git a/plugins/Google/plugin.py b/plugins/Google/plugin.py index 0f09af064..413bfc225 100644 --- a/plugins/Google/plugin.py +++ b/plugins/Google/plugin.py @@ -290,13 +290,15 @@ class Google(callbacks.PluginRegexp): def _googleUrl(self, s): s = s.replace('+', '%2B') 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 def _googleUrlIG(self, s): s = s.replace('+', '%2B') 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 _calcRe1 = re.compile(r']*>(.*?)', re.I)