diff --git a/plugins/Google.py b/plugins/Google.py index 61cf25b7a..a4a8ab919 100644 --- a/plugins/Google.py +++ b/plugins/Google.py @@ -287,7 +287,9 @@ class Google(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable): googleSnarfer = privmsgs.urlSnarfer(googleSnarfer) _ggThread = re.compile(r'
Subject: ([^<]+)
') + _ggPlainThread = re.compile(r'Subject: (.*)') _ggGroup = re.compile(r'Newsgroups: ]+>([^<]+)') + _ggPlainGroup = re.compile(r'Newsgroups: (.*)') def googleGroups(self, irc, msg, match): r"http://groups.google.com/[^\s]+" if not self.configurables.get('groups-snarfer', channel=msg.args[0]): @@ -297,7 +299,7 @@ class Google(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable): fd = urllib2.urlopen(request) text = fd.read() fd.close() - if match.group(0).find('&prev=/') >= 0: + if '&prev=/' in match.group(0): path = re.search('view the ]+)>no',text) if path is None: return @@ -308,8 +310,12 @@ class Google(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable): fd = urllib2.urlopen(request) text = fd.read() fd.close() - mThread = self._ggThread.search(text) - mGroup = self._ggGroup.search(text) + if '&output=gplain' not in match.group(0): + mThread = self._ggThread.search(text) + mGroup = self._ggGroup.search(text) + else: + mThread = self._ggPlainThread.search(text) + mGroup = self._ggPlainGroup.search(text) if mThread and mGroup: irc.reply(msg, 'Google Groups: %s, %s' % (mGroup.group(1), mThread.group(1)), prefixName = False) diff --git a/test/test_Google.py b/test/test_Google.py index e8b28d2d8..9d193ec4d 100644 --- a/test/test_Google.py +++ b/test/test_Google.py @@ -42,6 +42,9 @@ class GoogleTestCase(ChannelPluginTestCase, PluginDocumentation): 'lr=lang_en&ie=UTF-8&oe=UTF-8&selm=698f09f8.' '0310132012.738e22fc%40posting.google.com', r'comp\.lang\.python.*question: usage of __slots__') + self.assertRegexp('http://groups.google.com/groups?selm=ExDm.' + '8bj.23%40gated-at.bofh.it&oe=UTF-8&output=gplain', + r'linux\.kernel.*NFS client freezes') # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: