From 28385bec7abd24e9d0970b85bf8288648d652e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 6 Feb 2025 20:40:35 +0100 Subject: [PATCH] [bunkr] extract 'id_url' metadata (#6935) and use it as 'id' alternative instead of 'name' in default archive IDs --- gallery_dl/extractor/bunkr.py | 3 ++- test/results/bunkr.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/bunkr.py b/gallery_dl/extractor/bunkr.py index 8c1815e6..76cc1f11 100644 --- a/gallery_dl/extractor/bunkr.py +++ b/gallery_dl/extractor/bunkr.py @@ -60,7 +60,7 @@ class BunkrAlbumExtractor(LolisafeAlbumExtractor): """Extractor for bunkr.si albums""" category = "bunkr" root = "https://bunkr.si" - archive_fmt = "{album_id}_{id|name}" + archive_fmt = "{album_id}_{id|id_url}" pattern = BASE_PATTERN + r"/a/([^/?#]+)" example = "https://bunkr.si/a/ID" @@ -171,6 +171,7 @@ class BunkrAlbumExtractor(LolisafeAlbumExtractor): return { "file" : text.unescape(file_url), "name" : text.unescape(file_name), + "id_url" : webpage_url.rpartition("/")[2], "_http_headers" : {"Referer": response.url}, "_http_validate": self._validate, } diff --git a/test/results/bunkr.py b/test/results/bunkr.py index 37fe9888..ce83d23b 100644 --- a/test/results/bunkr.py +++ b/test/results/bunkr.py @@ -23,6 +23,7 @@ __tests__ = ( "file" : "https://brg-bk.cdn.gigachad-cdn.ru/test-%E3%83%86%E3%82%B9%E3%83%88-%22%26%3E-QjgneIQv.png", "filename" : "test-テスト-\"&>-QjgneIQv", "id" : "QjgneIQv", + "id_url" : "1044478", "name" : "test-テスト-\"&>", "num" : 1, }, @@ -62,7 +63,8 @@ __tests__ = ( "#class" : bunkr.BunkrAlbumExtractor, "#count" : 2, - "id": "", + "id" : "", + "id_url": {"UPKDHBf0CvrCe", "zQgSePr1f4HZ2"}, }, { @@ -223,6 +225,7 @@ __tests__ = ( "file" : "https://brg-bk.cdn.gigachad-cdn.ru/file-r5fmwjdd.zip", "filename" : "file-r5fmwjdd", "id" : "r5fmwjdd", + "id_url" : "38792076", "name" : "file", }, @@ -242,6 +245,7 @@ __tests__ = ( "#urls" : "https://kebab.bunkr.ru/80ca5405-8b8d-4f9f-8167-8b046bb9dc67.mp4", "id" : "", + "id_url" : "wYGCKbGhSvuAW", "name" : "0hwndshtfmj7hcbut1nd4_source", "filename" : "0hwndshtfmj7hcbut1nd4_source", "extension": "mp4",