diff --git a/seedbox.py b/seedbox.py index efe73c3..27e36ed 100644 --- a/seedbox.py +++ b/seedbox.py @@ -2,6 +2,7 @@ import argparse import re +import urllib.error import urllib.parse import urllib.request from pathlib import Path @@ -86,6 +87,7 @@ def parseCookieFile(file: Path, domain: str) -> None: def getSeedboxes(domain: str) -> tuple[list[dict], str]: + global COOKIE_HEADER try: req = urllib.request.Request( f"https://{domain}/users/{parsed_args.username}/seedboxes", @@ -94,6 +96,12 @@ def getSeedboxes(domain: str) -> tuple[list[dict], str]: with urllib.request.urlopen(req) as resp: html = resp.read().decode("utf-8") + for header, value in resp.getheaders(): + if header.lower() == "set-cookie": + cookie_val = value.split(";")[0] + if cookie_val not in COOKIE_HEADER: + COOKIE_HEADER += f"; {cookie_val}" + token_match = re.search( r'