aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/bunkr.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-01-28 19:12:16 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2025-01-28 19:12:16 -0500
commit5a7d8217a6edc66e3cf25ca0eee6614a10fa866c (patch)
treea941825bf5fcf706f23b49e536edb9a2b26d5b6c /gallery_dl/extractor/bunkr.py
parente8f1b0d968a07cba884462e10718628394d1bae5 (diff)
parenta26df18796ff4e506b16bf32fcec9336233b9e2e (diff)
Update upstream source from tag 'upstream/1.28.5'
Update to upstream version '1.28.5' with Debian dir a2e4b8ba663c03c37256ad2b059b382999e473bc
Diffstat (limited to 'gallery_dl/extractor/bunkr.py')
-rw-r--r--gallery_dl/extractor/bunkr.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/gallery_dl/extractor/bunkr.py b/gallery_dl/extractor/bunkr.py
index e1ee50d..25e9fd5 100644
--- a/gallery_dl/extractor/bunkr.py
+++ b/gallery_dl/extractor/bunkr.py
@@ -70,6 +70,7 @@ class BunkrAlbumExtractor(LolisafeAlbumExtractor):
self.root = "https://" + domain
def request(self, url, **kwargs):
+ kwargs["encoding"] = "utf-8"
kwargs["allow_redirects"] = False
while True:
@@ -114,8 +115,7 @@ class BunkrAlbumExtractor(LolisafeAlbumExtractor):
def fetch_album(self, album_id):
# album metadata
- page = self.request(
- self.root + "/a/" + album_id, encoding="utf-8").text
+ page = self.request(self.root + "/a/" + album_id).text
title = text.unescape(text.unescape(text.extr(
page, 'property="og:title" content="', '"')))
@@ -140,7 +140,8 @@ class BunkrAlbumExtractor(LolisafeAlbumExtractor):
file = self._extract_file(url)
info = text.split_html(item)
- file["name"] = info[-3]
+ if not file["name"]:
+ file["name"] = info[-3]
file["size"] = info[-2]
file["date"] = text.parse_datetime(
info[-1], "%H:%M:%S %d/%m/%Y")
@@ -157,6 +158,8 @@ class BunkrAlbumExtractor(LolisafeAlbumExtractor):
page = response.text
file_url = (text.extr(page, '<source src="', '"') or
text.extr(page, '<img src="', '"'))
+ file_name = (text.extr(page, 'property="og:title" content="', '"') or
+ text.extr(page, "<title>", " | Bunkr<"))
if not file_url:
webpage_url = text.unescape(text.rextract(
@@ -166,6 +169,7 @@ class BunkrAlbumExtractor(LolisafeAlbumExtractor):
return {
"file" : text.unescape(file_url),
+ "name" : text.unescape(file_name),
"_http_headers" : {"Referer": response.url},
"_http_validate": self._validate,
}