From 20e14a970f142eb487b87b71e728573df08a3319 Mon Sep 17 00:00:00 2001 From: CaliBrain Date: Wed, 30 Jul 2025 10:34:02 -0400 Subject: [PATCH] Force libgen bz proxy (#207) --- book_manager.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/book_manager.py b/book_manager.py index f46be857..6af5d603 100644 --- a/book_manager.py +++ b/book_manager.py @@ -1,6 +1,6 @@ """Book download manager handling search and retrieval operations.""" -import time, json +import time, json, re from pathlib import Path from urllib.parse import quote from typing import List, Optional, Dict, Union @@ -211,7 +211,10 @@ def _parse_book_info_page(soup: BeautifulSoup, book_id: str) -> BookInfo: and url.next.next is not None and "click “GET” at the top" in url.next.next.text.strip() ): - external_urls_libgen.add(url["href"]) + libgen_url = url["href"] + # TODO : Temporary fix ? Maybe get URLs from https://open-slum.org/ ? + libgen_url = libgen_url = re.sub(r'libgen\.(\w+)', 'libgen.bz', url["href"]) + external_urls_libgen.add(libgen_url) elif url.text.strip().lower().startswith("z-lib"): if ".onion/" not in url["href"]: external_urls_z_lib.add(url["href"])