Skip to content

Commit

Permalink
[bunkr] fix album extraction (#6798)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jan 10, 2025
1 parent 118b994 commit af9c06f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions gallery_dl/extractor/bunkr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand All @@ -122,7 +122,8 @@ def fetch_album(self, album_id):
"&lt;", "<").replace("&gt;", ">").replace("&amp;", "&")

# files
items = list(text.extract_iter(page, "<!-- item -->", "<!-- -->"))
items = list(text.extract_iter(
page, '<div class="grid-images_box', "</a>"))
return self._extract_files(items), {
"album_id" : album_id,
"album_name" : title,
Expand All @@ -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]
Expand Down

0 comments on commit af9c06f

Please sign in to comment.