home · contact · privacy
Fix buggy HTMLParser.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 19 Jan 2016 00:36:15 +0000 (01:36 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 19 Jan 2016 00:36:15 +0000 (01:36 +0100)
plomlombot.py

index f34d97a821378c5e092cf064a78a2137d82350c7..9e9d0a44ce21bc1d07204dcb9780c54ac1b31d0e 100755 (executable)
@@ -22,11 +22,12 @@ NICKNAME = USERNAME
 class HTMLParser(html.parser.HTMLParser):
     def __init__(self, html, tag):
         super().__init__()
+        self._tag_to_check = tag
         self._tag = ""
         self.data = ""
         self.feed(html)
     def handle_starttag(self, tag, attrs):
-        if self.data == "":
+        if self.data == "" and tag == self._tag_to_check:
             self._tag = tag
     def handle_endtag(self, tag):
         self._tag = ""