summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/bunkr.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/extractor/bunkr.py')
-rw-r--r--gallery_dl/extractor/bunkr.py36
1 files changed, 21 insertions, 15 deletions
diff --git a/gallery_dl/extractor/bunkr.py b/gallery_dl/extractor/bunkr.py
index 3e12452..e1ee50d 100644
--- a/gallery_dl/extractor/bunkr.py
+++ b/gallery_dl/extractor/bunkr.py
@@ -80,6 +80,9 @@ class BunkrAlbumExtractor(LolisafeAlbumExtractor):
# redirect
url = response.headers["Location"]
+ if url[0] == "/":
+ url = self.root + url
+ continue
root, path = self._split(url)
if root not in CF_DOMAINS:
continue
@@ -105,37 +108,40 @@ class BunkrAlbumExtractor(LolisafeAlbumExtractor):
"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
def fetch_album(self, album_id):
# album metadata
- page = self.request(self.root + "/a/" + album_id).text
- title, size = text.split_html(text.extr(
- page, "<h1", "</span>").partition(">")[2])
- if "&" in title:
- title = title.replace(
- "&lt;", "<").replace("&gt;", ">").replace("&amp;", "&")
+ page = self.request(
+ self.root + "/a/" + album_id, encoding="utf-8").text
+ title = text.unescape(text.unescape(text.extr(
+ page, 'property="og:title" content="', '"')))
# 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,
- "album_size" : text.extr(size, "(", ")"),
+ "album_size" : text.extr(
+ page, '<span class="font-semibold">(', ')'),
"count" : len(items),
}
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]
+ file["name"] = info[-3]
+ file["size"] = info[-2]
file["date"] = text.parse_datetime(
info[-1], "%H:%M:%S %d/%m/%Y")
@@ -179,8 +185,8 @@ class BunkrMediaExtractor(BunkrAlbumExtractor):
"""Extractor for bunkr.si media links"""
subcategory = "media"
directory_fmt = ("{category}",)
- pattern = BASE_PATTERN + r"(/[vid]/[^/?#]+)"
- example = "https://bunkr.si/v/FILENAME"
+ pattern = BASE_PATTERN + r"(/[fvid]/[^/?#]+)"
+ example = "https://bunkr.si/f/FILENAME"
def fetch_album(self, album_id):
try: