From af9c06f8129c8f6336be99c36ce90741ddd33903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 10 Jan 2025 11:00:32 +0100 Subject: [PATCH] [bunkr] fix album extraction (#6798) --- gallery_dl/extractor/bunkr.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gallery_dl/extractor/bunkr.py b/gallery_dl/extractor/bunkr.py index da60f187cf..ef88498fd1 100644 --- a/gallery_dl/extractor/bunkr.py +++ b/gallery_dl/extractor/bunkr.py @@ -81,7 +81,7 @@ def request(self, url, **kwargs): # redirect url = response.headers["Location"] if url[0] == "/": - url = text.root_from_url(response.url) + url + url = self.root + url continue root, path = self._split(url) if root not in CF_DOMAINS: @@ -108,7 +108,7 @@ def request(self, url, **kwargs): "All Bunkr domains require solving a CF challenge") # select alternative domain - root = "https://" + random.choice(DOMAINS) + self.root = root = "https://" + random.choice(DOMAINS) self.log.debug("Trying '%s' as fallback", root) url = root + path @@ -122,7 +122,8 @@ def fetch_album(self, album_id): "<", "<").replace(">", ">").replace("&", "&") # files - items = list(text.extract_iter(page, "", "")) + items = list(text.extract_iter( + page, '
")) return self._extract_files(items), { "album_id" : album_id, "album_name" : title, @@ -133,9 +134,11 @@ def fetch_album(self, album_id): def _extract_files(self, items): for item in items: try: - url = text.extr(item, ' href="', '"') - file = self._extract_file(text.unescape(url)) + url = text.unescape(text.extr(item, ' href="', '"')) + if url[0] == "/": + url = self.root + url + file = self._extract_file(url) info = text.split_html(item) file["name"] = info[0] file["size"] = info[2]