diff --git a/main.py b/main.py index 8e219f2..36ad485 100644 --- a/main.py +++ b/main.py @@ -65,16 +65,20 @@ for i in guilds: from html.parser import HTMLParser class TokenFinder(HTMLParser): - def __init__(self): - self.token=None + def __init__(self, admin_url): + self.token = None + self.delete_links = [] + self.admin_url = admin_url super().__init__() def handle_starttag(self, tag, attrs_tuple): - if tag != 'input': + if tag != 'input' and tag != 'a': return attrs = dict(attrs_tuple) - if tag == 'input' and 'type' in attrs and attrs['type'] == 'hidden' and 'name' in attrs and attrs['name'] == 'control' and 'value' in attrs: + if tag == 'input' and 'type' in attrs and attrs['type'] == 'hidden' and 'name' in attrs and attrs['name'] == 'control' and 'value' in attrs : self.token = attrs['value'] + elif tag == 'a' and 'href' in attrs and attrs['href'].startswith(self.admin_url + '/action/delete_column/') : + self.delete_links.append(attrs['href']) def create_framavote (guild, names):