mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-29 22:29:24 +01:00
Fixed gameknot.com URL snarfer formatting
This commit is contained in:
parent
4ee9dc7217
commit
ced5e6b052
@ -34,13 +34,15 @@ class Forums(callbacks.PrivmsgRegexp):
|
|||||||
|
|
||||||
gkPlayer = re.compile(r"popd\('(Rating[^']+)'\).*?>([^<]+)<")
|
gkPlayer = re.compile(r"popd\('(Rating[^']+)'\).*?>([^<]+)<")
|
||||||
def gameknot(self, irc, msg, match):
|
def gameknot(self, irc, msg, match):
|
||||||
r"http://gameknot.com/chess.pl\?bd=\d+&r=\d+"
|
r"http://(?:www\.)?gameknot.com/chess.pl\?bd=\d+&r=\d+"
|
||||||
fd = urllib2.urlopen(match.group(0))
|
fd = urllib2.urlopen(match.group(0))
|
||||||
s = fd.read()
|
s = fd.read()
|
||||||
try:
|
try:
|
||||||
((wRating, wName), (bRating, bName)) = self.gkPlayer.findall(s)
|
((wRating, wName), (bRating, bName)) = self.gkPlayer.findall(s)
|
||||||
wRating = wRating.replace('<br>', ' ')
|
wRating = wRating.replace('<br>', ' ')
|
||||||
bRating = bRating.replace('<br>', ' ')
|
bRating = bRating.replace('<br>', ' ')
|
||||||
|
wRating = wRating.replace('Wins', '; Wins')
|
||||||
|
bRating = bRating.replace('Wins', '; Wins ')
|
||||||
irc.queueMsg(ircmsgs.privmsg(msg.args[0],
|
irc.queueMsg(ircmsgs.privmsg(msg.args[0],
|
||||||
'%s (%s) vs. %s (%s)' % (wName, wRating, bName, bRating)))
|
'%s (%s) vs. %s (%s)' % (wName, wRating, bName, bRating)))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user