mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Make the groupsSnarfer work again with URLs that contain a threadm cgi section.
This commit is contained in:
parent
18ea1dee4d
commit
9077b1da6e
@ -445,8 +445,10 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
|
|
||||||
_ggThread = re.compile(r'Subject: <b>([^<]+)</b>', re.I)
|
_ggThread = re.compile(r'Subject: <b>([^<]+)</b>', re.I)
|
||||||
_ggGroup = re.compile(r'<TITLE>Google Groups :\s*([^<]+)</TITLE>', re.I)
|
_ggGroup = re.compile(r'<TITLE>Google Groups :\s*([^<]+)</TITLE>', re.I)
|
||||||
_ggThreadm = re.compile(r'view the <a href=([^>]+)>no', re.I)
|
_ggThreadm = re.compile(r'src="(/group[^"]+)">', re.I)
|
||||||
_ggSelm = re.compile(r'selm=[^&]+', re.I)
|
_ggSelm = re.compile(r'selm=[^&]+', re.I)
|
||||||
|
_threadmThread = re.compile(r'TITLE="([^"]+)">', re.I)
|
||||||
|
_threadmGroup = re.compile(r'class=groupname[^>]+>([^<]+)<', re.I)
|
||||||
def googleGroups(self, irc, msg, match):
|
def googleGroups(self, irc, msg, match):
|
||||||
r"http://groups.google.[\w.]+/\S+\?(\S+)"
|
r"http://groups.google.[\w.]+/\S+\?(\S+)"
|
||||||
if not self.registryValue('groupsSnarfer', msg.args[0]):
|
if not self.registryValue('groupsSnarfer', msg.args[0]):
|
||||||
@ -461,22 +463,21 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
mThread = None
|
mThread = None
|
||||||
mGroup = None
|
mGroup = None
|
||||||
if 'threadm=' in url:
|
if 'threadm=' in url:
|
||||||
# Let's just return from here until google decides to stop being
|
|
||||||
# in beta for their groups site
|
|
||||||
return
|
|
||||||
path = self._ggThreadm.search(text)
|
path = self._ggThreadm.search(text)
|
||||||
if path is None:
|
if path is not None:
|
||||||
return
|
url = 'http://groups-beta.google.com%s' % path.group(1)
|
||||||
url = 'http://groups.google.com%s' % path.group(1)
|
text = webutils.getUrl(url)
|
||||||
text = webutils.getUrl(url)
|
mThread = self._threadmThread.search(text)
|
||||||
mThread = self._ggThread.search(text)
|
mGroup = self._threadmGroup.search(text)
|
||||||
mGroup = self._ggGroup.search(text)
|
else:
|
||||||
|
mThread = self._ggThread.search(text)
|
||||||
|
mGroup = self._ggGroup.search(text)
|
||||||
if mThread and mGroup:
|
if mThread and mGroup:
|
||||||
irc.reply('Google Groups: %s, %s' % (mGroup.group(1),
|
irc.reply('Google Groups: %s, %s' % (mGroup.group(1),
|
||||||
mThread.group(1)), prefixName=False)
|
mThread.group(1)), prefixName=False)
|
||||||
else:
|
else:
|
||||||
irc.errorPossibleBug('That doesn\'t appear to be a proper '
|
self.log.debug('Unable to snarf. %s doesn\'t appear to be a '
|
||||||
'Google Groups page.')
|
'proper Google Groups page.' % match.group(1))
|
||||||
googleGroups = urlSnarfer(googleGroups)
|
googleGroups = urlSnarfer(googleGroups)
|
||||||
|
|
||||||
def _googleUrl(self, s):
|
def _googleUrl(self, s):
|
||||||
@ -527,8 +528,6 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
phonebook = wrap(phonebook, ['text'])
|
phonebook = wrap(phonebook, ['text'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Class = Google
|
Class = Google
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user