From f5de2ab14394f511f326603c7d9c11f6abe85f01 Mon Sep 17 00:00:00 2001 From: CaliBrain Date: Sun, 7 Sep 2025 13:57:43 -0400 Subject: [PATCH] Fix AA extension parsing (#275) Fix #274 --- book_manager.py | 17 +++++++++++++++-- genDebug.sh | 8 ++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/book_manager.py b/book_manager.py index 95d9bfa9..51d7e479 100644 --- a/book_manager.py +++ b/book_manager.py @@ -169,8 +169,21 @@ def _parse_book_info_page(soup: BeautifulSoup, book_id: str) -> BookInfo: data = soup.find_all("div", {"class": "main-inner"})[0].find_next("div") divs = list(data.children) - format = divs[13].text.split(" · ")[-6].strip().lower() - size = divs[13].text.split(" · ")[-5].strip().lower() + _details = divs[13].text.strip().lower().split(" · ") + format = "" + size = "" + for f in _details: + if format == "" and f.strip().lower() in SUPPORTED_FORMATS: + format = f.strip().lower() + if size == "" and any(u in f.strip().lower() for u in ["mb", "kb", "gb"]): + size = f.strip().lower() + + if format == "" or size == "": + for f in _details: + if f == "" and not " " in f.strip().lower(): + format = f.strip().lower() + if size == "" and "." in f.strip().lower(): + size = f.strip().lower() every_url = soup.find_all("a") slow_urls_no_waitlist = set() diff --git a/genDebug.sh b/genDebug.sh index 3c345217..8b78e5dd 100755 --- a/genDebug.sh +++ b/genDebug.sh @@ -125,16 +125,16 @@ fi env | grep -v -E "(AA_DONATOR_KEY)" | sort > "$LOG_DIR/environment.txt" echo "--- HTTPBin ---" > $LOG_DIR/network_info.txt -pyrequests https://httpbin.org/get >> $LOG_DIR/network_info.txt +curl -s https://httpbin.org/get >> $LOG_DIR/network_info.txt ehco "" echo "--- HowsMySSL ---" >> $LOG_DIR/network_info.txt -pyrequests https://www.howsmyssl.com/a/check >> $LOG_DIR/network_info.txt +curl -s https://www.howsmyssl.com/a/check >> $LOG_DIR/network_info.txt ehco "" echo "--- IPInfo ---" >> $LOG_DIR/network_info.txt -pyrequests https://ipinfo.io >> $LOG_DIR/network_info.txt +curl -s https://ipinfo.io >> $LOG_DIR/network_info.txt ehco "" echo "--- Cloudflare Trace ---" >> $LOG_DIR/network_info.txt -pyrequests https://1.1.1.1/cdn-cgi/trace >> $LOG_DIR/network_info.txt +curl -s https://1.1.1.1/cdn-cgi/trace >> $LOG_DIR/network_info.txt # Create the zip file directly from LOG_DIR ln -s "$LOG_DIR" /tmp/$OUTPUT_FILE_NAME