mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Failed google now handled in googleSnarfer.
This commit is contained in:
parent
663a9f75ae
commit
c31078339b
@ -170,9 +170,14 @@ class GooglePrivmsgRegexp(callbacks.PrivmsgRegexp):
|
||||
threaded = True
|
||||
def googleSnarfer(self, irc, msg, match):
|
||||
r"^google\s+(.*)$"
|
||||
data = google.doGoogleSearch(match.group(1), safeSearch=1)
|
||||
url = data.results[0].URL
|
||||
irc.queueMsg(ircmsgs.privmsg(ircutils.replyTo(msg), url))
|
||||
searchString = match.group(1)
|
||||
data = google.doGoogleSearch(searchString, safeSearch=1)
|
||||
if data.results:
|
||||
url = data.results[0].URL
|
||||
irc.queueMsg(ircmsgs.privmsg(ircutils.replyTo(msg), url))
|
||||
else:
|
||||
irc.queueMsg(ircmsgs.privmsg(ircutils.replyTo(msg),
|
||||
'No results for "%s"' % searchString))
|
||||
|
||||
_ggThread = re.compile(r'<br>Subject: ([^<]+)<br>')
|
||||
_ggGroup = re.compile(r'Newsgroups: <a[^>]+>([^<]+)</a>')
|
||||
|
Loading…
Reference in New Issue
Block a user