working a bit more

This commit is contained in:
Adrian 2024-11-07 19:48:17 +01:00
parent 8a3ded3673
commit 8f9e7d0bd6

12
main.py
View File

@ -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):